I have created a developer app and set the authentication to JWT as seen below.
When I create the app, I get a client_id and client_secret and once I connect the app to a workspace, I get the following info
key: <Same as Above>
clientKey:ari:cloud:bitbucket::app/<Workspace UUID>/<key (same as above)>publicKey: <Public Key>sharedSecret: <client_secret>
While trying to generate the JWT Token I am using the python library atlassian_jwt as follows:
import atlassian_jwttoken = atlassian_jwt.encode_token(http_method="GET", url="https://api.bitbucket.org/2.0/repositories/<workspace name>/<repo name>/diff/96c7b8e", clientKey=<clientKey that was generated above>, sharedSecret="<Shared Secret from above>")
The token I get here, when used to make the call to the URL "https://api.bitbucket.org/2.0/repositories/<workspace name>/<repo name>/diff/96c7b8e" results in a 401 unauthorised error.
Kindly let me know if I there is a mistake of some kind here which is causing this problem
Hello @nithin bodanapu and welcome to the Community!
The Bitbucket Cloud API documentation has a section containing instructions on how to exchange the JWT connect token for an OAuth access token that can then be used to make requests to Bitbucket Cloud API :
If after following those instructions you are still facing issues with the authentication, since this is more of an app development question, as you are using a developer app to authenticate, I would suggest reaching out to our community dedicated to developers:
as they will have more expertise on this topic.
Thank you, @nithin bodanapu !
Patrik S
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.