recover

abstract suspend fun recover(request: ITOTPsRecoverParameters): TOTPsRecoverResponse

Authenticates the user with a TOTP recovery code instead of a time-based code. Calls the POST /sdk/v1/totps/recover endpoint. Each recovery code can only be used once.

Kotlin:

StytchConsumer.totps.recover(
TOTPsRecoverParameters(recoveryCode = "recovery-code", sessionDurationMinutes = 30)
)

iOS:

let params = TOTPsRecoverParameters(recoveryCode: "recovery-code", sessionDurationMinutes: 30)
let response = try await StytchConsumer.totps.recover(params)

React Native:

StytchConsumer.totps.recover({ recoveryCode: "recovery-code", sessionDurationMinutes: 30 })

Return

TOTPsRecoverResponse containing the authenticated session and user.

Parameters

request
  • ITOTPsRecoverParameters

  • recoveryCode — A one-time-use recovery code issued during TOTP setup.

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

Throws

StytchError

if the recovery code is invalid or has already been used.

if the coroutine is cancelled.