attach

abstract suspend fun attach(request: IOAuthAttachParameters): OAuthAttachResponse

Creates an OAuth attach token that can be used to link an OAuth provider to an existing authenticated session. Calls the POST /sdk/v1/oauth/attach endpoint. Pass the returned attach token as oauthAttachToken in a subsequent OAuthType.start call.

Kotlin:

StytchConsumer.oauth.attach(
OAuthAttachParameters(provider = "google")
)

iOS:

let params = OAuthAttachParameters(provider: "google")
let response = try await StytchConsumer.oauth.attach(params)

React Native:

StytchConsumer.oauth.attach({ provider: "google" })

Return

OAuthAttachResponse containing the oauthAttachToken to pass to OAuthType.start.

Parameters

request
  • IOAuthAttachParameters

  • provider — The OAuth provider identifier (e.g. "google", "apple", "github").

Throws

StytchError

if the request fails or no active session exists.

if the coroutine is cancelled.