authenticate

abstract suspend fun authenticate(request: IB2BSSOAuthEnticateParameters): B2BSSOAuthenticateResponse

Authenticates an SSO token received via deeplink after the browser-based SSO flow completes, establishing a member session. Calls the POST /sdk/v1/b2b/sso/authenticate endpoint. Retrieves the PKCE code verifier stored during the start call, and automatically includes the intermediate session token if one is present.

Use this method when handling deeplinks manually; prefer start for the end-to-end flow.

Kotlin:

StytchB2B.sso.authenticate(
B2BSSOAuthEnticateParameters(
ssoToken = "token",
sessionDurationMinutes = 30,
)
)

iOS:

let params = B2BSSOAuthEnticateParameters(ssoToken: "token", sessionDurationMinutes: 30)
let response = try await StytchB2B.sso.authenticate(params)

React Native:

StytchB2B.sso.authenticate({ ssoToken: "token", sessionDurationMinutes: 30 })

Return

B2BSSOAuthenticateResponse containing the authenticated member session.

Parameters

request
  • IB2BSSOAuthEnticateParameters

  • ssoToken — The SSO token extracted from the deeplink URL.

  • sessionDurationMinutes — Duration of the session to create, in minutes.

  • locale? — Locale for any follow-up communications.

Throws

StytchError

if the token is invalid, expired, or no PKCE verifier is found in storage.

if the coroutine is cancelled.