Forum Discussion

1 Reply

  • 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)