Skip to Content
Clerk logo

Clerk Docs

Ctrl + K
Go to clerkstage.dev

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

NameTypeDescription
sessionIdstringThe ID of the session to retrieve a token for.
templatestringThe 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.

What did you think of this content?

Clerk © 2023