Forums

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

how to solve "{"message":"Client must be authenticated to access this resource.","status-code":401}"

Daud Rauf July 4, 2022
I need to get event stream of the organisation via web-hook on my given callback.
I got my token using OAuth 2.0 (3LO) and successfully got my cloud Id for generating the url to make further requests. The url i have generated is as:

https://api.atlassian.com/ex/jira/{cloudid}/rest/api/3/webhook

I tried to make a get request with list of web-hooks:

const data await axios.get(
headers: {
    Authorization: `Bearer ${token}`,
    Accept: 'application/json',
 }});

 it gives me 200 status with response:

{
"maxResults": 100,
"startAt": 0,
"total": 0,
"isLast": true,
"values": []
}

but unable to make post request with given URL need to register the webhook. Giving this error

data: {
message: ‘Client must be authenticated to access this resource.’,
‘status-code’: 401
}

 

1 answer

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.
July 5, 2022

The OAuth 2.0 token has a lifetime of 1hr if I'm not mistaken. So you might want to reauthenticate or use a refresh token instead, so you do not have to reauth all the time (which I think is too much of a hassle if that happens).

Suggest an answer

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

Atlassian Community Events