authenticate
abstract suspend fun authenticate(request: IMagicLinksAuthenticateParameters): MagicLinksAuthenticateResponse
Authenticates a magic link token received via deeplink, establishing a session for the user. Calls the POST /sdk/v1/magic_links/authenticate endpoint. Retrieves the PKCE code verifier stored during the corresponding EmailMagicLinksClient.loginOrCreate or EmailMagicLinksClient.send call.
Kotlin:
StytchConsumer.magicLinks.authenticate(
MagicLinksAuthenticateParameters(
token = "token",
sessionDurationMinutes = 30,
)
)Content copied to clipboard
iOS:
let params = MagicLinksAuthenticateParameters(token: "token", sessionDurationMinutes: 30)
let response = try await StytchConsumer.magicLinks.authenticate(params)Content copied to clipboard
React Native:
StytchConsumer.magicLinks.authenticate({ token: "token", sessionDurationMinutes: 30 })Content copied to clipboard
Return
MagicLinksAuthenticateResponse containing the authenticated session and user.
Parameters
request
IMagicLinksAuthenticateParameters
token— The magic link token extracted from the deeplink URL.sessionDurationMinutes— Duration of the session to create, in minutes.
Throws
StytchError
if the token is invalid or expired, or if no PKCE verifier is found in storage.
if the coroutine is cancelled.