Skip to main content
Class Built-in AuthManager that authenticates users via email OTP.

OTP flow

The JWT is refreshed automatically before expiry; no app-level polling is required.

Initializers

init(apiKey:)

init(authService:secureStorage:)

Instance Properties

Instance Methods

confirmEmailOtp(email:code:)

Validates the OTP code and, on success, establishes an authenticated session.

Discussion

Must be called after sendEmailOtp(email:) with the same email address. Throws AuthManagerError.noPendingOTP if no email has been sent yet.

logout()

Invalidates the server-side refresh token and clears the local session.

Discussion

Has no effect if the user is not currently authenticated.

oneTimeSecretAuthentication(oneTimeSecret:)

reset()

Clears the local session state without contacting the server.

Discussion

Use this when the server session is already gone (e.g. the refresh token expired or was revoked externally) and you just need to reset local state. Prefer logout() when the session is still valid and you want to revoke the server-side token as well.

sendEmailOtp(email:)

Sends a one-time password to the given email address. Call confirmEmailOtp(email:code:) next.

setJWT(_:)

Inherited from AuthManager.setJWT(_:).