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

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

What's Wrong With My Token Generation.

What's wrong with my JWT generation I am using this code to generate JWTScreenshot 2021-03-29 at 9.47.35 PM.png

const jwt = require('atlassian-jwt');

const moment = require('moment');

const now = moment().utc();

const clientKey='XXXXXXXXXXXX';

const sharedSecret = 'XXXXXXXXXXXXXX';

const req = jwt.fromMethodAndUrl('GET', '{bfd8fa1a-XXX-XXX-XXX-XXXXXXX}');

const tokenData = {

"iss": 'codelock',

"iat": now.unix(),

"exp": now.add(30, 'minutes').unix(),

"qsh": jwt.createQueryStringHash(req),

"sub": clientKey


const token = jwt.encode(tokenData, sharedSecret);console.log(token);

1 answer

1 accepted

1 vote
Answer accepted
Dario B Atlassian Team Apr 06, 2021

Hello @Saikat Samanta ,

Welcome to the Atlassian Community!

I might not be the best person to answer development related questions, however, looking at your screenshot I can see that you are providing a wrong authorization header.

Indeed, in your screenshot I can see:

Authorization: JWT <token>


While it is supposed to be:

Authorization: Bearer <token>


Therefore, there are chances there is nothing wrong with the code to generate the JWT token and that the issue is just with the authorization header you are providing.


Can you kindly try to use the correct header and check if this works?


Finally, for the future, please notice that this is not the best place to get help on development  related questions. The right resources are listed in 





Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Bitbucket

New improvements to user management in Bitbucket Cloud 👥

Hey Community! We’re willing to wager that quite a few of you not only use Bitbucket, but administer it too. Our team is excited to share that we’ll be releasing improvements throughout this month of...

3,889 views 10 16
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you