What's wrong with my JWT generation I am using this code to generate JWT
const jwt = require('atlassian-jwt');
const moment = require('moment');
const now = moment().utc();
const clientKey='XXXXXXXXXXXX';
const sharedSecret = 'XXXXXXXXXXXXXX';
const req = jwt.fromMethodAndUrl('GET', 'https://api.bitbucket.com/2.0/repositories/{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);
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 https://developer.atlassian.com/resources.
Specifically:
Cheers,
Dario
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.