Earlier this month I converted from username/password to API token for my ruby script
options = {
:site => "<jira site>",
:context_path => "",
:auth_type => :basic,
"Authorization" => "Basic <base64 encoded email:apitoken>",
"Content-Type" => "application/json",
}
@@client = JIRA::Client.new option
However, my ruby script only gets an HTTPError and when I try curl:
curl -D- -u <base64 encoded email:apitoken> -X GET -H "Content-Type: application/
json" <jira web page>
It prompts me:
Enter host password for user '<base64 encoded email:apitoken>':
If i enter the password curl gives me the web page. So I have two questions: 1) Why is curl prompting me and 2) why doesn't the script connect as it's using the same things as the curl command?
Dear @Greg Sternberg ,
just to be sure - you are using Jira Server, correct? Then you can only OAuth or basic auth. Api Token is for cloud, only.
Or do you connect against Cloud?
So long
Thomas
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Dear @Greg Sternberg ,
there is an article describing a solution for python. Hope you can translate this to Ruby.
So long
Thomas
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thomas,
The python code put me on the right track as it worked so I knew it had something to to with the jira-ruby package. So between reading the source and some experimentation the answer was simple - don't base64 encode and don't build the authorization header - i.e. do:
options = {
:site => "<jira site>",
:context_path => "",
:auth_type => :basic,
:user => "<email>",
:password => "<apitoken>",
}
@client = JIRA::Client.new option
Thanks!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
JIRA authentication so confusing.You must have a concise "rightway to do it" documentation.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.