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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,463,987
Community Members
 
Community Events
176
Community Groups

JWT format is invalid when /installed is called when reinstalling a Bitbucket app

Edited

(Cross posted here too)

 

Problem:

I am seeing a JWT format error when re-installing a Bitbucket connect app:

{} Authentication verification error (401): Invalid JWT: Unexpected token m in JSON at position 0

To reproduce:

  1. Create, run and install the sample Bitbucket connect app according to the "getting started" guide at https://developer.atlassian.com/cloud/bitbucket/getting-started/
  2. Re-install the app by re-visiting the installation link from step 9 of the "getting started" guide.

Expected:

The application is re-installed without error.

Actual:

The call to "/installed" results in a 401 error being thrown:

{} Authentication verification error (401): Invalid JWT: Unexpected token m in JSON at position 0
POST /installed 401 33234.738 ms - 53

Notes:

Looking at the incoming request, I can see the Authorisation header looks like this:

Authorization: JWT b'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJhcmk6Y2xvdWQ6Yml0YnVja2V0OjphcHAve2I2YzRiNzcwLWZjMDgtNDcxMS05NTdkLTU2MGExMzU4YjM4ZH0vZXhhbXBsZS1hcHAtMTIzNDU2IiwiZXhwIjoxNjU3MzAwMDg0LCJpYXQiOjE2NTcyOTY0ODQsInFzaCI6IjRhMmUxZGU4Y2E3NGU2Y2FmZTg4NjJkMzMyZmEzYWM3YThlNTFlNjkyYmM2ZDc5OGVhNGRmZWRjMTQ5NDhiZjQiLCJhdWQiOiJhcmk6Y2xvdWQ6Yml0YnVja2V0OjphcHAve2I2YzRiNzcwLWZjMDgtNDcxMS05NTdkLTU2MGExMzU4YjM4ZH0vZXhhbXBsZS1hcHAtMTIzNDU2In0.PLgvhYcfdObBX6eEbxHzJxoajeNcjCaJBuGGdwtlzjQ'

Notice that the JWT starts with b' and also ends with a single quote.  This is causing an error in the "atlassian-jwt/dist/lib/jwt.js" module when decoding the JWT.

If you remove the leading b' and trailing quote then the JWT looks correct.  Something on the Atlassian/Bitbucket side seems to be generating wrapped/invalid JWTs when making that "/installed" API call.

1 answer

1 accepted

0 votes
Answer accepted

This issue has now been resolved after Atlassian applied a fix on their side.

 

Also see here: https://community.developer.atlassian.com/t/jwt-format-is-invalid-when-installed-is-called-when-reinstalling-a-bitbucket-app/59747/1

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS

Atlassian Community Events