Auth class

Constructors

Auth(ClientOptions _opts)

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

emailStart(String email) Future<OtpStartResponse>
POST /v1/auth/email/start — cache OTP + send email.
emailVerify(String email, String code) Future<AuthResponse>
POST /v1/auth/email/verify — consume code, find-or-create user, mint JWT.
emailVerifyConfirm(String email, String token) Future<bool>
POST /v1/auth/email/verify/confirm — flip email_verified=true.
emailVerifyStart(String email) Future<OtpStartResponse>
POST /v1/auth/email/verify/start — email a verification token.
getSession() MortarSession?
The current (in-memory) session, or null if not signed in. supabase-dart returns { session }; here it's the MortarSession directly (or null).
getUser() Future<MortarUser>
The signed-in user — GET /v1/auth/me. Throws MortarApiError 401 when not signed in (no envelope). supabase-dart returns { user }; here it's the MortarUser directly.
listOAuthProviders() Future<List<OAuthProviderConfiguration>>
me() Future<MeResponse>
GET /v1/auth/me — the signed-in user's full profile (native).
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onAuthStateChange(void callback(AuthChangeEvent event, MortarSession? session)) AuthSubscription
Subscribe to auth-state changes — supabase-dart onAuthStateChange((event, session) => …). Fires initialSession once synchronously on subscribe, then signedIn / signedOut / tokenRefreshed. Returns an AuthSubscription; call unsubscribe().
passwordResetConfirm(String email, String token, String newPassword) Future<bool>
POST /v1/auth/password/reset/confirm — consume token, update hash.
passwordResetStart(String email) Future<OtpStartResponse>
POST /v1/auth/password/reset/start — email a reset token.
phoneStart(String phone) Future<OtpStartResponse>
POST /v1/auth/phone/start — cache OTP + send SMS.
phoneVerify(String phone, String code) Future<AuthResponse>
POST /v1/auth/phone/verify — consume code, find-or-create user, mint JWT.
refreshSession() Future<AuthResponse>
POST /v1/auth/refresh — exchange the current refresh token for a fresh access token. Updates the current session + emits tokenRefreshed. Throws StateError if there is no session to refresh.
resetPasswordForEmail(String email, {String? redirectTo}) Future<OtpStartResponse>
Send a password-reset email — supabase-dart resetPasswordForEmail. Envelope-free form of passwordResetStart; redirectTo is accepted for parity (Mortar emails a token, not a link).
signIn({required String email, required String password}) Future<AuthResponse>
Alias of signInWithPassword (the original Mortar Dart name).
signInWithOtp({String? email, String? phone}) Future<OtpStartResponse>
Send a login OTP — signInWithOtp(email: …) or signInWithOtp(phone: …). Routes to email-OTP or phone-OTP by which arg is set. Exactly one of email / phone is required.
signInWithPassword({required String email, required String password}) Future<AuthResponse>
POST /v1/auth/signin — verify password, mint JWT. supabase-dart names this signInWithPassword; signIn is kept as an alias.
signInWithProvider({required OAuthProvider provider, String? connection, String? authorizationCode, String? idToken, String? redirectUri, String? nonce, String? codeVerifier}) Future<AuthResponse>
Exchange a provider authorization code or OIDC ID token for a Mortar session. The app must validate OAuth state before this call.
signOut() Future<void>
POST /v1/auth/signout — revoke the refresh token server-side (best-effort) and clear the in-memory session. Emits signedOut. Idempotent.
signUp({required String email, required String password}) Future<AuthResponse>
POST /v1/auth/signup — create a new end-user account. Sets the current session and emits signedIn.
toString() String
A string representation of this object.
inherited
verifyOtp({String? email, String? phone, required String token}) Future<AuthResponse>
Verify a login OTP and mint a session — verifyOtp(email: …, token: …) or verifyOtp(phone: …, token: …). Sets the current session and emits signedIn. Exactly one of email / phone is required.

Operators

operator ==(Object other) bool
The equality operator.
inherited