Getting Invalid JWT when running Headless Bot Sample

Hey there,

So I have been using the Headless bot sample for a while now with no issues. I am currently rewriting it to be able to handle bigger meetings, but now I am getting Invalid JWT half of the time I run the image.

It is not consistent, but around 50% of the times I run docker compose up I get authentication failed because the JWT is invalid.

Here is the generateJWT function:

void Zoom::generateJWT(const string& key, const string& secret) {

    m_iat = std::chrono::system_clock::now();
    m_exp = m_iat + std::chrono::hours{24};

    m_jwt = jwt::create()
            .set_type("JWT")
            .set_issued_at(m_iat)
            .set_expires_at(m_exp)
            .set_payload_claim("appKey", claim(key))
            .set_payload_claim("tokenExp", claim(m_exp))
            .sign(algorithm::hs256{secret});
}

Here is an example of a JWT that is invalid:
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhcHBLZXkiOiJRODdJdENUSFIzeVM5ZUtoakd6RXp3IiwiZXhwIjoxNzMwODQ0MDMyLCJpYXQiOjE3MzA3NTc2MzIsInRva2VuRXhwIjoxNzMwODQggpLGU0cz80K5k0fGXBrBMuBkowc0-vjQ

I have tried using both the development and the production ID and secret. I’m not sure if I should share those here.

Thanks,
Noah Schenk

Hey Noah, if you’re experiencing intermittent ‘Invalid JWT’ errors while running the Headless bot sample, you might want to check out the Recall.ai API.

It’s a simple 3rd party API that lets you use meeting bots to get raw audio/video/metadata from meetings without you needing to spend months to build, scale and maintain these bots.

Here are the API docs:

@noahviktorschenk ,

Have you decoded the JWT and compared the failed and successful claims? Here’s a video on debugging JWT that you can check out:

No, I did not think of that, I will try it, Thank you!

@noahviktorschenk are you still have issues with this? If you are, share a sample of your JWT token here, and tag me in your response

@chunsiong.zoom Sorry for not marking it as resolved, but yes, the issue seems to have resolved itself. I have not had the issue since my last message. I did not change anything so not sure what was causing it. Thank you for the help.