Docsfrontbacked.js reference
On this page

Authentication reference

Create accounts, sign in and manage credentials.

Method signatures

js

Reference excerpt: use this with the page, variables and functions described in this guide. Try a complete example →

Before you begin: Storage reference.

Auth Helpers

Frontbacked.signUp({ email, password, name, username, data, emailVerification }) creates a user account. On success, if the response returns a token, Frontbacked stores it in the browser and updates $auth.

Verification emails during signup are currently paused. The emailVerification option is still accepted for compatibility, but signup does not send a verification email even when this option is provided. Use Frontbacked.sendEmailVerification() when your site explicitly needs to verify the signed-in user's address.

js

Reference excerpt: use this with the page, variables and functions described in this guide. Try a complete example →

emailVerification.redirectTo remains an optional signup setting, but has no effect while signup verification is paused. For a separate verification request, pass redirectTo to Frontbacked.sendEmailVerification() to choose the local page to open after successful verification.

Frontbacked.signIn({ email, password, rememberMe }) signs in. On success, Frontbacked stores the token and updates $auth. rememberMe defaults to true; true keeps the user signed in across browser restarts, while false keeps sign-in for the current browser session.

js

Reference excerpt: use this with the page, variables and functions described in this guide. Try a complete example →

Frontbacked.signOut() and Frontbacked.logout() are the same operation. They remove the auth token from both browser storage locations, set $auth.exists to false, and re-render state-dependent UI.

Frontbacked.checkUsernameAvailability(username) checks whether a username is available before signup or profile updates.

Frontbacked.signInWithProvider(provider, options?) and Frontbacked.signUpWithProvider(provider, options?) start a provider sign-in or signup flow from JavaScript. provider defaults to "google". Use options.returnTo or options.redirectTo for the local page to open after sign-in when your UI needs a custom destination.

Use Frontbacked.signInWithProvider("frontbacked", { returnTo: "/dashboard" }) or Frontbacked.signUpWithProvider("frontbacked", { returnTo: "/dashboard" }) to offer Frontbacked account sign-in after enabling it in the site’s account settings. The declarative equivalent is f-auth-provider="frontbacked".

Frontbacked.signInWithGoogle(options?) and Frontbacked.signUpWithGoogle(options?) are Google-specific aliases. Frontbacked.completeProviderAuth(...) and Frontbacked.completeGoogleAuth(...) are available for custom callback pages; most themes can use f-auth-provider and let Frontbacked complete the flow automatically.

Frontbacked.sendEmailVerification({ email, redirectTo }) sends or resends the current user's email verification link. Frontbacked checks the current $auth.emailVerified value first; when it is already true, it returns { ok: true, message: "Email is already verified." } without sending a request. Frontbacked also enforces that only unverified email addresses for the authenticated user are sent.

js

Reference excerpt: use this with the page, variables and functions described in this guide. Try a complete example →

Frontbacked.requestPasswordReset({ email, path }) requests a password reset email. path is the local page the reset email link should open, such as /password-reset. The response uses a generic success message so account existence is not leaked.

js

Reference excerpt: use this with the page, variables and functions described in this guide. Try a complete example →

Frontbacked.passwordReset(...) remains available as a compatibility alias for Frontbacked.requestPasswordReset(...).

Frontbacked.confirmPasswordReset({ email, token, newPassword }) submits the new password from a password reset page. email and token normally come from the reset email URL query string.

js

Reference excerpt: use this with the page, variables and functions described in this guide. Try a complete example →

Frontbacked.updateUserData({ data, merge }) updates the signed-in user's public auth data. merge defaults to true; when false, the submitted object replaces the existing data payload.

Frontbacked.updatePassword({ currentPassword, newPassword }) updates the signed-in user's password. Frontbacked verifies currentPassword before storing newPassword.

Continue with Billing reference.