authenticate

abstract suspend fun authenticate(request: IB2BOAuthDiscoveryAuthenticateParameters): B2BOAuthDiscoveryAuthenticateResponse

Authenticates a discovery OAuth token received via deeplink after a browser-based discovery OAuth flow completes. Calls the POST /sdk/v1/b2b/oauth/discovery/authenticate endpoint. Retrieves the PKCE code verifier stored during the B2BOAuthProviderDiscoveryClient.start call. Returns discovered organizations and an intermediate session token; call B2BDiscoveryIntermediateSessionsClient.exchange to establish a full member session.

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

Kotlin:

StytchB2B.oauth.discovery.authenticate(
B2BOAuthDiscoveryAuthenticateParameters(
discoveryOauthToken = "token",
)
)

iOS:

let params = B2BOAuthDiscoveryAuthenticateParameters(discoveryOauthToken: "token")
let response = try await StytchB2B.oauth.discovery.authenticate(params)

React Native:

StytchB2B.oauth.discovery.authenticate({ discoveryOauthToken: "token" })

Return

B2BOAuthDiscoveryAuthenticateResponse containing discovered organizations and an intermediate session token.

Parameters

request
  • IB2BOAuthDiscoveryAuthenticateParameters

  • discoveryOauthToken — The discovery OAuth token extracted from the deeplink URL.

Throws

StytchError

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

if the coroutine is cancelled.