authenticate

abstract suspend fun authenticate(request: IB2BMagicLinksDiscoveryAuthenticateParameters): B2BMagicLinksDiscoveryAuthenticateResponse

Authenticates the discovery magic link token received via deeplink, returning an intermediate session token and the list of discovered organizations. Calls the POST /sdk/v1/b2b/magic_links/discovery/authenticate endpoint. Retrieves the PKCE code verifier stored during the corresponding emailSend call.

Kotlin:

StytchB2B.magicLinks.discovery.authenticate(
B2BMagicLinksDiscoveryAuthenticateParameters(
discoveryMagicLinksToken = "token",
)
)

iOS:

let params = B2BMagicLinksDiscoveryAuthenticateParameters(discoveryMagicLinksToken: "token")
let response = try await StytchB2B.magicLinks.discovery.authenticate(params)

React Native:

StytchB2B.magicLinks.discovery.authenticate({ discoveryMagicLinksToken: "token" })

Return

B2BMagicLinksDiscoveryAuthenticateResponse containing an intermediate session token and a list of discovered organizations.

Parameters

request
  • IB2BMagicLinksDiscoveryAuthenticateParameters

  • discoveryMagicLinksToken — The discovery token extracted from the magic link deeplink URL.

Throws

StytchError

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

if the coroutine is cancelled.