Forums

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

Any API that I am using of Jira Cloud Rest platform, each one of them is giving error response

Sahil Anower August 9, 2023

Any API that I am using of Jira Cloud Rest platform, each one of them is giving error response of 

{
    "message": "Client must be authenticated to access this resource.",
    "status-code": 401
}
even when I am passing the access bearer token in the request. Please can some one help?
My request -> 
--header 'Authorization: Bearer eyJraWQiOiJmZTM2ZThkMzZjMTA2N2RjYTgyNTg5MmEiLCJhbGciOiJSUzI1NiJ9.eyJqdGkiOiJhNjYzNzY3Yi02ZmExLTQ2N2MtOWUxNy1kNTcyM2FhYjIwOTYiLCJzdWIiOiI4akw3TTQzV0QxSTMxT0loVWZSTEJFcGRpbGZLTTMyaEBjbGllbnRzIiwibmJmIjoxNjkxNTg4NDU5LCJpc3MiOiJodHRwczovL2F1dGguYXRsYXNzaWFuLmNvbSIsImlhdCI6MTY5MTU4ODQ1OSwiZXhwIjoxNjkxNTkyMDU5LCJhdWQiOiJhcGkuYXRsYXNzaWFuLmNvbSIsInNjb3BlIjoicmVhZDptZSByZXBvcnQ6cGVyc29uYWwtZGF0YSIsImh0dHBzOi8vaWQuYXRsYXNzaWFuLmNvbS9wcm9jZXNzUmVnaW9uIjoidXMtZWFzdC0xIiwiaHR0cHM6Ly9hdGxhc3NpYW4uY29tL3N5c3RlbUFjY291bnRFbWFpbCI6ImEyYTQxN2MxLWNjNDAtNGRmNi05YmJiLTQ4NzEwNzFlYWFkZUBjb25uZWN0LmF0bGFzc2lhbi5jb20iLCJodHRwczovL2lkLmF0bGFzc2lhbi5jb20vYXRsX3Rva2VuX3R5cGUiOiJBQ0NFU1MiLCJodHRwczovL2F0bGFzc2lhbi5jb20vb2F1dGhDbGllbnRJZCI6IjhqTDdNNDNXRDFJMzFPSWhVZlJMQkVwZGlsZktNMzJoIiwiaHR0cHM6Ly9hdGxhc3NpYW4uY29tL3N5c3RlbUFjY291bnRJZCI6IjcxMjAyMDpiZDZkMDkxNy0xNGEwLTRhNTEtOTc2OC0zNTFlN2YxYTBiNTkiLCJjbGllbnRfaWQiOiJhcGkuYXRsYXNzaWFuLmNvbSIsImh0dHBzOi8vYXRsYXNzaWFuLmNvbS9maXJzdFBhcnR5IjpmYWxzZSwiaHR0cHM6Ly9hdGxhc3NpYW4uY29tLzNsbyI6ZmFsc2UsImh0dHBzOi8vYXRsYXNzaWFuLmNvbS9zeXN0ZW1BY2NvdW50RW1haWxEb21haW4iOiJjb25uZWN0LmF0bGFzc2lhbi5jb20ifQ.O_5oVrL8EmgDFram-Fxo_q828eLyjvo90l92NMERA-Bl6_uI1x-Luc9olgHw4JVgx8IGKeJECSaZwhuoLT_nFsMiwcRMoz99B9rSirBKSkFY4PkrW-YZf1OG8s8o3Yn6LeT1iIpZySuef8o3pzqzS9bN6WXxLYD6VEJQBG_5nb7-7DOzHiQ2_EtfcbbEwywEDCuHiyLqY0NbkMCEolYQ-sktnhuMl9VYcXXy_AWzhk9kvcvEHcV7JduWMiIyt5mFPJxMAL0qofCxh_1Swo2-9iaaOqT5C4_1OQxfatBCs8giILaWsXpOGOOn-WTX_ph4kM36TeZj4OgWvWNCG78qMQ' \
--header 'Accept: application/json' \
--header 'Cookie: atlassian.xsrf.token=f36a1be0-49a5-43e6-8542-e30466da8ed4_ffe95f4a68ebeef7d6fdd8dbe1fbffa808dbde4d_lout'

2 answers

0 votes
Prince Nyeche
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.
August 9, 2023

Hi @Sahil Anower 

Your grant_type should be the "authorization_code" and you need the code generated from the redirect_url to authenticate this initial request to the OAuth token resource provided by Atlassian. Probably you should take another look into the OAuth flow so you know exactly where you should change in your script.

0 votes
Sugandha Singh
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 9, 2023

Hello @Sahil Anower 

Welcome to Atlassian Community!!!

If you get the same error on all the endpoints, could you please confirm you're using a valid email and token to authenticate?

As mentioned in Basic auth for REST APIs, basic authentication with password is not accepted so you will need to use an email:token pair to authenticate.

See the Atlassian Cloud Support API tokens article to discover how to generate an API token.

Sahil Anower August 9, 2023

No I was using the access token generated from this curl -> 

--header 'Content-Type: application/json' \
--header 'Cookie: JSESSIONID=3C1C05AC77B714FD56866557B7E7CA48' \
--data '{
    "audience""api.atlassian.com", 
    "grant_type":"client_credentials",
    "client_id""e24NaHrFNVOnDdS8jHvDXjPxz5ktifvu",
    "client_secret""ATOAPWWgLSVkX1-qXkGAv4j4FT8m0AmMDuiaGRkjTESXstKpLuu0_nuFQ5GKz2CVdkBE9E3B29B4"
}'

Suggest an answer

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

Atlassian Community Events