authenticateGoogleIdToken

abstract suspend fun authenticateGoogleIdToken(request: IOAuthGoogleIDTokenAuthenticateParameters): OAuthGoogleIDTokenAuthenticateResponse

Authenticates a Google ID token obtained via native Android Google Sign-In. Calls the POST /sdk/v1/oauth/google/id_token/authenticate endpoint.

This method is called automatically by OAuthClient.google start() on Android — you typically only need to call it directly if you are supplying the ID token yourself.

Kotlin:

StytchConsumer.oauth.authenticateGoogleIdToken(
OAuthGoogleIDTokenAuthenticateParameters(
idToken = "google-id-token",
sessionDurationMinutes = 30,
)
)

iOS:

let params = OAuthGoogleIDTokenAuthenticateParameters(
idToken: "google-id-token",
sessionDurationMinutes: 30
)
let response = try await StytchConsumer.oauth.authenticateGoogleIdToken(params)

React Native:

StytchConsumer.oauth.authenticateGoogleIdToken({ idToken: "google-id-token", sessionDurationMinutes: 30 })

Return

OAuthGoogleIDTokenAuthenticateResponse containing the authenticated session and user.

Parameters

request
  • IOAuthGoogleIDTokenAuthenticateParameters

  • idToken — The Google ID token from native Google Sign-In.

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

  • nonce? — The nonce used when requesting the ID token, for replay protection.

  • oauthAttachToken? — An OAuth attach token to link this provider to an existing session.

Throws

StytchError

if the ID token is invalid or expired.

if the coroutine is cancelled.