Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot connect to Jira Server v9.4.17 using a token #215

Open
hilsonp opened this issue Mar 20, 2024 · 1 comment
Open

Cannot connect to Jira Server v9.4.17 using a token #215

hilsonp opened this issue Mar 20, 2024 · 1 comment

Comments

@hilsonp
Copy link

hilsonp commented Mar 20, 2024

I can connect to the Jira API using a curl using the Authorization Bearer like this:
curl -vH "Authorization: Bearer abcdefghabcdefghijklabcdefghijklabcdefghijkl" https://myjiraserver.com/jira/rest/api/2/project

The Bearer token was created like this: https://support.atlassian.com/atlassian-account/docs/manage-api-tokens-for-your-atlassian-account/

When I configure the Jira Plugin in ReadyAPI (pro), I'm forced to specify "email or username".
I can then provide an API Token
and the Jira server URL

I tried with both my username and my email address (seen in my Jira Profile), my valid API token and the server address.
This fails.

Here is an abstract from the "HTTP Log" for a trial with my username (USER1), my API token and the server address https://myjiraserver.com/jira/

http-outgoing-11 >> "GET /jira/rest/api/2/project HTTP/1.1[\r][\n]"
http-outgoing-11 >> "Authorization: Basic xyzxyzxyzxyzxyzxyzxyzxy=[\r][\n]"
http-outgoing-11 >> "Accept: application/json[\r][\n]"
http-outgoing-11 >> "Via: 1.1 localhost (Apache-HttpClient/4.5.13 (cache))[\r][\n]"
http-outgoing-11 >> "Host: myjiraserver.com[\r][\n]"
http-outgoing-11 >> "Connection: Keep-Alive[\r][\n]"
http-outgoing-11 >> "User-Agent: Atlassian HttpClient 2.1.5 / Atlassian JIRA Rest Java Client-5.2.4 (0) / Default[\r][\n]"
http-outgoing-11 >> "[\r][\n]"
http-outgoing-11 << "HTTP/1.0 403 Forbidden[\r][\n]"

The error is:
Unable to retrieve information from JIRA. Possible causes: - The JIRA Integration plugin settings are invalid. You might have specified email instead of username. - You do not have enough permissions in JIRA.

From what I can see, the problem is that the API Token is used to compute an Authorization Basic.

Can you allow us to keep the "email or username" field empty and in this case:

  • Use the value in the "API Token or Password" as an API Token
  • Use the provided API Token as HTTP Header Authorization: Bearer

Thank you.

@hilsonp
Copy link
Author

hilsonp commented Mar 21, 2024

Here is my little contribution to solve this problem:
#216

But honnestly, all credit goes to other clever people:
https://community.atlassian.com/t5/Jira-Software-questions/How-do-I-use-a-personal-access-token-PAT-in-jira-rest-java/qaq-p/1859167

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant