Skip to main content
@exegia/plugin-supabase-auth wraps Tauri’s invoke with types. There is no client to construct and no provider to mount — import the function you need.
Sessions returned to the webview are sanitized: they carry the access token, expiry, token type and user, and never a refresh token.

Session lifecycle

Promise<SignUpResult>
{ status: "signedIn" | "pendingConfirmation", session? }. Reports pendingConfirmation when the project requires email confirmation. data becomes user_metadata.
Promise<Session>
Email and password sign-in.
Promise<void>
Sends a magic link or one-time code.
Promise<Session>
Redeems a code. type is "email" | "sms" | "recovery".
Promise<Session>
Opens the system browser and resolves when the loopback round-trip completes. See OAuth. redirectTo is web-only: it picks the page GoTrue returns the browser to (omitted, the project’s Site URL; provided, it must be in the project’s Redirect URLs allow-list). On Tauri it is accepted and ignored — the loopback listener owns the redirect.
Promise<void>
Aborts an in-flight browser round-trip so the plugin stops waiting on the loopback instead of holding it for the full flow timeout.
Promise<void>
Local-first: state clears even if the network is down.
Promise<Session | null>
The current session, or null.
Promise<User | null>
The current user, or null.
Promise<Session>
Manual refresh. Background refresh is automatic unless autoRefresh is disabled.

Account

These require opt-in permissions.
Promise<void>
Sends a recovery message. Needs allow-reset-password-for-email.
Promise<User>
Updates the signed-in user. Needs allow-update-user.
Promise<Identity[]>
The sign-in identities attached to the account. Needs allow-get-identities.
Attaches a provider identity to the current account via the system browser. Needs allow-link-identity and enable_manual_linking on the project. redirectTo behaves as in signInWithOAuth: web-only, allow-listed, ignored on Tauri.
Disconnects an identity. Removing the last sign-in method is refused with lastSignInMethod. Needs allow-unlink-identity.

Passkeys

Promise<PasskeyCapability>
{ usable, reason? }. Never touches the network — gate passkey UI on it.
Promise<PasskeySignInResult>
Discoverable sign-in, no email needed. Resolves { status: "cancelled" } when the user dismisses the OS prompt — that is not an error.
Promise<PasskeyRegistrationResult>
Adds a passkey to the current account. The name is server-derived; rename it afterwards.
Promise<Passkey[]>
Credentials registered on the account.
Promise<Passkey>
friendlyName is 1–120 characters.
Promise<void>
Deleting the last passkey is not blocked server-side. Confirm with the user first.
Promise<PasskeyChallenge> / Promise<PasskeyRegistrationResult>
Two-step surface for apps running their own WebAuthn ceremony.
Promise<PasskeyChallenge> / Promise<PasskeySignInResult>
The authentication half of the same surface.

Auth state events

The plugin pushes state changes over a Tauri event. There is no polling.

Types

Rejections are always a structured AuthError, never a bare string.