authenticate

abstract suspend fun authenticate(request: IPasswordsAuthenticateParameters): PasswordsAuthenticateResponse

Authenticates a user with their email address and password, establishing a session. Calls the POST /sdk/v1/passwords/authenticate endpoint.

Kotlin:

StytchConsumer.passwords.authenticate(
PasswordsAuthenticateParameters(
email = "user@example.com",
password = "secretpassword",
sessionDurationMinutes = 30,
)
)

iOS:

let params = PasswordsAuthenticateParameters(
email: "user@example.com",
password: "secretpassword",
sessionDurationMinutes: 30
)
let response = try await StytchConsumer.passwords.authenticate(params)

React Native:

StytchConsumer.passwords.authenticate({
email: "user@example.com",
password: "secretpassword",
sessionDurationMinutes: 30,
})

Return

PasswordsAuthenticateResponse containing the authenticated session and user.

Parameters

request
  • IPasswordsAuthenticateParameters

  • email — The user's email address.

  • password — The user's password.

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

Throws

StytchError

if the credentials are invalid.

if the coroutine is cancelled.