Is there a working / full example of
# general-english
e
Is there a working / full example of implementing JWT for the webclient somewhere? the docs are missing some critical information like what encoding algoritm to use. Not getting any wiser from searching here on discord. I'm using jose to create the token:
Copy code
ts
        // Get the private key from environment variables
        const key = new TextEncoder().encode(process.env.VAPI_PRIVATE_KEY)

        // Generate the token using a JWT library or built-in functionality
        const token = await new SignJWT(payload)
          .setProtectedHeader({ alg: 'HS256' })
          .setExpirationTime('1h')
          .sign(key)
Copy code
// Generate the token using a JWT library or built-in functionality
What does built-in functionality even mean?
would be a big help if this was simply built into the Vapi server sdk.
d
The "VAPI_PRIVATE_KEY" is being properly set correct? The HS256 should be correct assuming the key itself is 32 characters long. Everything else looks spot on though.
e
Yeah i set the key i got from the org / api keys settings in our account.
5 Views