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

Oauth Implicit grant returns invalid access token for some users

Dan Abel January 5, 2021

I am using Oauth 2.0 Implicit grant from point 2. in the docs here: https://developer.atlassian.com/bitbucket/api/2/reference/meta/authentication

It works perfectly for almost all members of out team (20+), however there are 2 accounts where the token returned is invalid every time and the token they receive looks different to the ones that work. These 2 users cannot use the app I have built at all as a result.

An example of a correct response that works would be:

<callback URL>#access_token=FAKEaRs4L3FHKNtoncuywSMu4l8OCRfy25ac0VeVGavcRO1cOZvKeZ14woTOkCh6KJBBBlBctH52qZ7MRY9Sr7qzFPOcBfVA2eMRB6wvnrcATfbWdaqU9fSo&scopes=account+pullrequest%3Awrite&expires_in=7200&token_type=bearer

Token above has been replaced with random string here, but it is 120 chars long, alphanumeric with the occasional dash sometimes. This can be used to make API calls for 2 hours before it needs refreshing.

The 2 accounts that do not work return something like this:

<callback URL>#access_token=8abc-FAKEaRs4L3FHKNtoncuywSMu4l8OCRfy25ac0VeVG_eZ14woTO_H52qZ7MRY9Sr7qz_BlBctH52qZ7MR-HKNtoncuywSMu4l-qsfPnjY2-FoydYlMLERQqinVbmMWL97_WgtZa01w%3D%3D&scopes=account+pullrequest%3Awrite&expires_in=7200&token_type=bearer

So the token here is longer than 120 chars and has underscores that makes it look like the token is split into sections. It also has `%3D%3D` as the end of the token, (or `==` if it has been URL decoded). This token does not work at any time.

I get the error message "Access token expired. Use your refresh token to obtain a new access token." if I try to use it, even if I use it straight away.

Does anyone know what is going on? Or how to fix it?

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events