XRay cloud REST API Authorization error 401

Zakhar Yermakovich April 4, 2023

I'm trying to use REST API for Jira-Xray Cloud. I looked through this pages https://docs.getxray.app/display/XRAYCLOUD/Authentication+-+REST+v2 and https://docs.getxray.app/display/XRAYCLOUD/Global+Settings%3A+API+Keys

I only found this page https://id.atlassian.com/manage-profile/security/api-tokens for creating a user token. And I cannot see Client Id and Client Secret there. I only have the token created. 

Then I tried a REST API request with the token created, but got 401 "Invalid JWT: JsonWebTokenError: jwt malformed".

What am I doing wrong?

Xray_1.png

1 answer

1 accepted

1 vote
Answer accepted
Stefan Salzl
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 4, 2023

Hi @Zakhar Yermakovich - welcome to the community,

Do you have admin permission in your system?

The settings for API client & secret need to be set in admin section of the site. 

Click the coq icon in the upper right corner and select "Apps". This will lead you into the admin console where apps/plugins are managed. In the left menu bar scroll down until you reach the xray section. There you´ll find a dedicated menu item for API keys (see screenshots below).

image.pngimage.png

Hope this was helpful.

Best
Stefan

Zakhar Yermakovich April 4, 2023

Thank you for the answer.

I do not have admin permissions in my system. But do I have to have them? I thought I only need a token to connect to the REST API and I created a token...

Zakhar Yermakovich April 4, 2023

May be I just use the token incorrect way?
The error message in response is says "jwt malformed"...

Stefan Salzl
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 4, 2023

In this case (to store an xray api token): Yes admin rights are needed.

You created a token for the jira REST API. As you would like to authenticate to XRAY REST API you would need a separate token for that API.

If you don´t have admin rights please contact your site/jira admin and clarify the use case behind. I´m sure they will find a solution.

Best
Stefan

Stefan Salzl
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 5, 2023

Any update? could you contact your jira admin?

Best
Stefan

Zakhar_Ermakovich April 5, 2023

Hi Stefan! 
(This is my second account)

I appreciate your help. It looks like you are right.

I still didn't reach the admin, he is at a vacation.

But I created a support ticket and they said almost the same as you did.

Like Stefan Salzl likes this
Stefan Salzl
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 5, 2023

I do a lot of support and answering questions related to xray as a community leader. The api key topic is kinda confusing for many users and the question was asked frequently. (and I‘m a heavy xray user and admin as well).

Please consider to hit the accept button next to the answer. This will mark the posting as solved and makes it easier for other users to find the right solution for their problems.

Best
Stefan

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS
AUG Leaders

Atlassian Community Events