resetByEmail

abstract suspend fun resetByEmail(request: IPasswordsEmailResetParameters): PasswordsEmailResetResponse

Completes the email password reset flow by setting a new password using the token from the reset link. Calls the POST /sdk/v1/passwords/email/reset endpoint. Retrieves the PKCE code verifier stored during the corresponding resetByEmailStart call.

Kotlin:

StytchConsumer.passwords.resetByEmail(
PasswordsEmailResetParameters(
token = "token",
password = "newpassword",
sessionDurationMinutes = 30,
)
)

iOS:

let params = PasswordsEmailResetParameters(
token: "token",
password: "newpassword",
sessionDurationMinutes: 30
)
let response = try await StytchConsumer.passwords.resetByEmail(params)

React Native:

StytchConsumer.passwords.resetByEmail({
token: "token",
password: "newpassword",
sessionDurationMinutes: 30,
})

Return

PasswordsEmailResetResponse containing the authenticated session and user.

Parameters

request
  • IPasswordsEmailResetParameters

  • token — The password reset token extracted from the deeplink URL.

  • password — The new password to set for the user.

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

Throws

StytchError

if the token is invalid or expired, or if no PKCE verifier is found in storage.

if the coroutine is cancelled.