authenticate

abstract suspend fun authenticate(request: ISessionsAuthenticateParameters): SessionsAuthenticateResponse

Validates the current session token against the Stytch backend and optionally extends the session. Calls the POST /sdk/v1/sessions/authenticate endpoint.

Kotlin:

StytchConsumer.sessions.authenticate(
SessionsAuthenticateParameters(sessionDurationMinutes = 30)
)

iOS:

let params = SessionsAuthenticateParameters(sessionDurationMinutes: 30)
let response = try await StytchConsumer.sessions.authenticate(params)

React Native:

StytchConsumer.sessions.authenticate({ sessionDurationMinutes: 30 })

Return

SessionsAuthenticateResponse containing the validated session and user.

Parameters

request
  • ISessionsAuthenticateParameters

  • sessionDurationMinutes? — If provided, extends the session by this many minutes from the current time.

Throws

StytchError

if the session token is invalid or expired.

if the coroutine is cancelled.