start
Initiates a discovery OAuth browser flow for the provider, allowing the user to enumerate organizations before authenticating. Opens a browser session at https://{domain}/b2b/public/oauth/{provider}/discovery/start, then automatically calls POST /sdk/v1/b2b/oauth/discovery/authenticate, returning discovered organizations and an intermediate session token.
Kotlin:
val response = StytchB2B.oauth.google.discovery.start(
B2BOAuthDiscoveryStartParameters(
discoveryRedirectUrl = "myapp://discovery",
)
)iOS:
let params = B2BOAuthDiscoveryStartParameters(discoveryRedirectUrl: "myapp://discovery")
let response = try await StytchB2B.oauth.google.discovery.start(params)React Native:
StytchB2B.oauth.google.discovery.start({ discoveryRedirectUrl: "myapp://discovery" })Return
B2BOAuthDiscoveryAuthenticateResponse containing discovered organizations and an intermediate session token.
Parameters
B2BOAuthDiscoveryStartParameters
discoveryRedirectUrl?— URL to redirect to after the discovery flow completes.customScopes?— Additional OAuth scopes to request from the provider.providerParams?— Provider-specific query parameters to append to the OAuth URL.activity?(Android only) — The AndroidActivityused to launch the browser.oauthPresentationContextProvider?(iOS only) — Presentation context for theASWebAuthenticationSession.
Throws
if the OAuth flow fails or the token cannot be exchanged.
if the coroutine is cancelled.