You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
(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:
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.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.