Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Ruby on Rails Authentication for REST API

Ben Niemietz July 9, 2013

I'm having problems authenticating with the REST API. Here is my code.....

basic_auth = { :user_name => 'bniemietz@enfocussolutions.com', :password => 'password' }
headers = { 'Content-Type' => 'application/json' }
response = HTTParty.get("https://enfocus.atlassian.net/jira/auth/latest/session.json", :basic_auth => auth, :headers => headers)

any suggestions?

5 answers

0 votes
Ben Niemietz July 15, 2013

username is not an email....it was only bniemietz.

0 votes
Jeff Curry
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 9, 2013

If you're utilizing basic auth you won't have a session per se- you'll supply credentials for every action your script makes.

See https://developer.atlassian.com/display/JIRADEV/JIRA+REST+API+Example+-+Basic+Authentication for further details

0 votes
Ben Niemietz July 9, 2013

I can't use the Oauth.....gotta stick with basic auth.

0 votes
Ben Niemietz July 9, 2013

Sorry....had this. Still not working though.

basic_auth = { :user_name => 'bniemietz@enfocussolutions.com', :password => 'password' }
headers = { 'Content-Type' => 'application/json' }
response = HTTParty.get("https://enfocus.atlassian.net/jira/auth/latest/session.json", :basic_auth => basic_auth, :headers => headers)

0 votes
CelsoA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 9, 2013

Hi there,

I think that this GEM can do the trick for you:

http://rubygems.org/gems/omniauth_crowd

This works with Crowd, and it's documentation can be found on this one:

http://rubydoc.info/gems/omniauth_crowd/2.1.1/frames

Regards.

Celso Yoshioka,

Suggest an answer

Log in or Sign up to answer
TAGS
atlassian, team ’25 europe guide, teamwork collection, atlassian events, conference guide, team culture, collaboration tools, ai in teamwork, atlassian learning, event schedule, keynote previews, community events

Must attend events for Team Europe '25!

Make the most of your time in Barcelona with our curated guide – discover how Jira, Confluence, Loom, and Rovo work better together, connect with Atlassian experts, and enter to win an Apple prize bundle!

Get the guide
AUG Leaders

Atlassian Community Events