getToken()
Retrieves a token for a JWT Template that is defined in the Clerk Dashboard on the JWT Templates page.
In the example below, a token for the session with the ID my-session-id
is retrieved and the token is generated using the test
JWT Template.
const sessionId = 'my-session-id'; const template = 'test'; const session = await clerkClient.sessions.getToken(sessionId, template);
Required parameters
Name | Type | Description |
---|---|---|
sessionId | string | The ID of the session to retrieve a token for. |
template | string | The name of the JWT template from the Clerk Dashboard to generate a new token from. E.g. 'firebase', 'grafbase', or your custom template's name. |