Skip to Content
Auth for your appOverview

Auth for your app

Use Foir as the authentication layer for your app — hosted sign-in, user accounts, sessions, and roles — without touching the CMS. You get a login screen your users can sign in to today, EdDSA access tokens your backend can verify, and user data that is isolated per project at the database layer.

This track is for teams who want an auth provider (the way you’d reach for Clerk, Auth0, or Better Auth), not a content platform. Everything here works whether or not you ever define a single content model.

What you get

  • Hosted sign-in on your own login.your-domain.com, or Foir’s: Foir renders the page, and your app gets the tokens back. See Hosted sign-in.
  • Password, OTP, and OAuth/OIDC sign-in, plus user accounts with per-user profile and metadata.
  • An account page for your users. Their name, picture and language; where they are signed in, and signing out of one session or of all of them; the providers they sign in with; the apps they have authorised; personal access tokens; their second factors and recovery codes; and closing the account. Each is the user’s own and asks no permission. See Your users’ account page.
  • Short-lived EdDSA access tokens (15 minutes) and rotating refresh tokens (30 days), verifiable from your backend against a public JWKS — see User Authentication.
  • Database-level isolation. User-owned rows are protected by row-level security keyed to the signed-in user, not by application checks you have to remember to write. See Authorization.
  • Lifecycle webhooks — USER_CREATED, USER_UPDATED, USER_DELETED and the session events. A hook carries no URL of its own: you define an operation with the endpoint, and attach a hook that names it. See Webhooks and Hook Events.
  • Usage-based billing you can see — monthly active users, team seats, and auth email sends, metered and surfaced in the dashboard. See How auth is billed.

Four ways to integrate

Pick the shape that fits your app. All four return the same user tokens.

ApproachYou buildBest for
Hosted sign-inA redirect and a callback routeMost apps: no sign-in page to build or maintain
Token APIYour own sign-in form calling signIn / register / OTPApps that want a fully custom sign-in UI
First-party sessionsThe server that renders your pages keeps the user’s tokens and sets its own HttpOnly cookieApps with a server that want cookie sessions, not bearer tokens
Foir-hosted sessionsNothing — Foir sets the cookie on your domainBackend-less SPAs that still want no tokens in JavaScript

The hosted flow is the recommended default: you register your app once, add a redirect and a callback, and Foir hosts everything in between. Start with the Quickstart.

The last two give the strongest posture: no access or refresh token is ever reachable from JavaScript. Use Foir-hosted sessions if you have no server (it needs a custom login domain); hold the session on your own server if you have one.

Where to go next

Last updated on