createSignInToken()
Creates a new sign-in token for the given user. By default, sign-in tokens expire in 30 days. You can optionally specify a custom expiration time in seconds using the expiresInSeconds parameter.
Returns the created SignInToken object.
function createSignInToken(params: CreateSignInTokensParams): Promise<SignInToken>const userId = 'user_123'
const orgId = 'org_123'
const expiresInSeconds = 60 * 60 * 24 * 7 // 1 week
const response = await clerkClient.signInTokens.createSignInToken({
userId,
orgId,
expiresInSeconds,
})The orgId parameter scopes the token to an Organization: when the token is redeemed, Clerk activates that Organization for the new session. Organizations must be enabled for the instance, and the user must be a member of the Organization. To consume the returned token in a native app, pass response.token to signInWithTicket() for Android or signInWithTicket() for iOS.
Backend API (BAPI) endpoint
This method in the SDK is a wrapper around the BAPI endpoint POST /sign_in_tokens. The SDK's orgId parameter is sent to the Backend API as org_id. See the BAPI reference for more information.
Feedback
Last updated on