Continue an action after sign-in
Show loading feedback and resume an authenticated action.
Before you begin: Check state before submitting.
Automatic Loading State
When a Frontbacked network request starts inside an FQL event handler, Frontbacked locks the triggering element until the request finishes. While locked, repeated calls from the same element are ignored, the element gets a frontbacked-loading class, and Frontbacked disables the element when the browser supports disabling it.
f-loading-text temporarily replaces the element's text while the request is pending. f-loading-attr-X temporarily sets any HTML attribute, where X is the attribute name. For example, f-loading-attr-aria-busy="true" sets aria-busy="true" while loading and restores the previous value afterward.
Add f-loading="off" when you want Frontbacked to leave that trigger's UI completely alone. With this attribute present, Frontbacked still sends the request, but it does not add frontbacked-loading, does not change text, does not set loading attributes, does not disable the element, and does not block re-entrant requests from that trigger. Older themes may still use f-loading-disabled="true" for the same behavior.
Style the loading state in the theme:
This works for buttons, selects, inputs, and any other element that triggers an FQL event. If the event is a form submit and the browser exposes a submitter button, Frontbacked locks that submitter; otherwise it locks the event-bound element.
Sign In and Continue an Action
Let visitors choose a plan, sign in, and continue to checkout without filling in the same details again. Register a named action with Frontbacked.authActions.define() on every page where that action can start or resume:
Reference excerpt: use this with the page, variables and functions described in this guide. Try a complete example →
Bind it to an FQL click or submit action. In this example, checkout contains the selected product ID and a stable attemptId generated once for that checkout attempt:
authAction() passes the click or submit event to the registered action. For browser interactions that need JavaScript, call Frontbacked.authActions.run("startCheckout", body, event) from the visitor's click or submit handler. Keep the original event when awaiting a picker or dialog. Calls without a real visitor event can still run the endpoint and its callbacks, but cannot start an authentication redirect. Ordinary endpoint calls and page queries keep their existing behavior.
When an eligible action returns authRequired: true, Frontbacked asks the visitor whether to sign in, remembers the permitted inputs for up to ten minutes in that tab, and opens the public sign-in page. It uses signInPath, or discovers a same-site sign-in link when that option is omitted. The page must exist, allow visitors who are signed out, and use a standard sign-in route or f-auth-page="signin". Sign-in must also be enabled for the site. If a usable page cannot be confirmed or browser storage is unavailable, the original error reaches onError.
After successful sign-in or sign-up, Frontbacked returns the visitor to their original page and resumes the named endpoint once, after the page is ready. Register the action before calling Frontbacked.init(). The resumed response runs the same onSuccess or onError callback. Frontbacked does not rerun the original click handler or other requests that preceded the failed action.
Auth forms should honor authContinuation before their usual success message or redirect:
Reference excerpt: use this with the page, variables and functions described in this guide. Try a complete example →
Apply the same check after Frontbacked.signUp(). Built-in provider buttons preserve the pending return destination automatically. Cancelling the sign-in prompt returns { ok: false, authContinuation: true, cancelled: true } without showing an extra failure message.
Choose mode: "return" to bring the visitor back without repeating the endpoint. Choose mode: "manual" to always leave authentication failures to onError. A frontbacked:auth-required event on document provides { name, response, body }; call event.preventDefault() to suppress the built-in prompt and redirect and let the action's onError handle the response. Call Frontbacked.authActions.clear() to discard a pending continuation, for example when cancelling a custom authentication flow.
Only declare simple, non-sensitive JSON input fields. Do not include passwords, tokens, card details, files, or private form data. Browser storage is editable and accessible to other scripts on the same site, so FRL must still validate every input and permission. Changing accounts cancels a continuation that started under a different known account. Signing out clears it too. If the selected currency changes during sign-in, Frontbacked asks the visitor to review the selection instead of repeating the amount in a different currency.
Resumable actions require a stable idempotencyField and server-enforced deduplication. Keep authorization checks before all side effects and before dedupe:
Rule input (JSON)
Use a complete version 2 rule file. Select a post with “postType” and “action”, or an “endpoint” by name. Saved data, jobs, payments and email need the local server. Dedupe replay protection also needs a site.
Check complete rules or run schemas, permissions, hooks and calculations against the input above. Add excerpts to a complete rule before running.
Use the same attempt ID and inputs after an uncertain outcome. A continuation prepares checkout; the visitor still authorizes payment. A second authentication failure stops automatic continuation. If you change an action's meaning or input contract, bump its optional version string so older saved inputs cannot resume under the new definition.