Ask a Question

JWT Token generation alternatives

Murgen90
Occasional Visitor

JWT Token generation alternatives

Is there any other way to generate JWT tokens besides using the sample Java shown here? https://support.smartbear.com/zephyr-squad-cloud/docs/api/jwt-token.html

 

Is there a REST API or even just a sample JSON body I could use to get converted to a JWT using jwt.io or something?

1 REPLY 1
FernandoBooster
New Contributor

You should be able to generate the JWT token using anything that can make a POST request. Any scripting language or even Postman can generate one. I have no idea why they give the worst possible java code as an example. 
Here is my implementation in Javascript + superagent

 

 

const superagent = require('superagent');
let jwtToken
const JWT_GENERATE_URL = 'https://prod-vortexapi.zephyr4jiracloud.com/api/v1/jwt/generate'
const ZEPHYR_ACCESS_KEY = XXXXXXXX
const ZEPHYR_SECRET_KEY = XXXXXXXX
const ZEPHYR_ADMIN_USER_ID = XXXXXXXX
const jwtTokenRequestBody = {
    "accessKey": ZEPHYR_ACCESS_KEY,
    "secretKey": ZEPHYR_SECRET_KEY,
    "accountId": ZEPHYR_ADMIN_USER_ID}
try {
    const res = await superagent
        .post(JWT_GENERATE_URL)
        .set('Content-Type', 'application/json')
        .send(jwtTokenRequestBody);
    jwtToken = res.text
} catch (err) {
    console.error(err);
}
console.log(jwtToken)

 

 

 

cancel
Showing results for 
Search instead for 
Did you mean: