Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How can I validate if a token is still valid using the REST API?

eddivalen
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
April 1, 2024

Hey there!

I'm facing a problem in figuring out if a token is still valid. It would really save me some issues to avoid sending requests with an invalid token. Right now, the only clue that I have the token is invalid is because I'm getting  an empty response, but this is not enough.

I'm not sure if an empty response could be returned in a different scenario. Please let me know if there's a way to know if the token is still valid.

1 answer

1 accepted

2 votes
Answer accepted
milynnus
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.
April 1, 2024

@eddivalen 

I think the error message - not authorised, will tell you whether you have used an invalid or non existing token. 

eddivalen
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
April 2, 2024

Thank you @milynnus

Yup, I can tell from the HTTP status code—I'm getting a 401 whenever this happens.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events