JWT Token generation alternatives
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2023
09:25 AM
02-15-2023
09:25 AM
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?
Labels:
- Labels:
-
APIs
-
Cloud
-
InsideZephyrSquad
1 REPLY 1
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-22-2023
06:01 PM
02-22-2023
06:01 PM
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)
