getToken()
Retrieves a token for a JWT Template that is defined in the Clerk Dashboard on the JWT Templates(opens in a new tab) 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(opens in a new tab) to generate a new token from. E.g. 'firebase', 'grafbase', or your custom template's name. |