0

I am making an app which integrates with bitbucket using oauth. My question is how do I get the token details such as the token expiry date or the token permissions.
Is there any endpoint on the bitbucket API which will give me these details

SOLVED: Bitbucket Tokens have an expiry time of 1 hour after which we need to use the provided refresh token to refresh our access token.

Vini.g.fer
  • 11,639
  • 16
  • 61
  • 90
Nahush Farkande
  • 5,290
  • 3
  • 25
  • 35

1 Answers1

0

Bitbucket don't have a published method to query an access token.

You can see all the OAUTH methods here:

OAuth on Bitbucket Cloud

It probably doesn't matter, since they expire tokens every 60 minutes, so you would most likely need to request a refresh any way. And in the refresh it will give you a new access token, and tell you the expiry again (in 60 minutes) and also the permissions (scopes) you were asking about.

A refresh response doesn't need to occur within the 60 minute limit, so you just refresh when you are about to use it. It will respond with:

{"access_token": "", "scopes": "", "expires_in": 3600, "refresh_token": "", "token_type": "bearer"}

Where permissions would be like: "wiki pullrequest project team account" and they are also listed under the linked page above (in the Scopes section).

peterept
  • 4,407
  • 23
  • 32