AAuthfy Docs

Architecture

This page explains the concepts you'll meet everywhere else in these docs.

The three building blocks

Access is the intersection of the three: a user can use your application when they are an active member of a company that is subscribed to it. A subscription can cover the whole company, or only selected categories (teams/departments) within it.

How sign-in works

When a user clicks "Sign in" in your app:

  1. Your app sends them to Authfy's hosted sign-in page (the authfy npm package builds this redirect for you, with PKCE protection).
  2. The user authenticates with Authfy — your app never sees their password.
  3. Authfy checks which of the user's companies is subscribed to your application and resolves the company for this session automatically.
  4. The user is redirected back to your app with a one-time code, which your app's backend exchanges for tokens.

Your app receives:

Access and ID tokens are RS256-signed JWTs, signed with your application's own key. Your app verifies them locally with your application public key — no network call needed. The important claims are sub (user), company_id / company_slug (the resolved company), email, and name — the full list is in JWT verification.

Sessions

Authfy keeps one shared activity session per user across all connected apps. As long as the user is active in any connected app, silent token refresh keeps working everywhere; once they go idle everywhere, sessions expire together. Signing out can end just your app's session or the whole SSO session.

What stays on the platform

Some things are deliberately not your app's problem:

Who does what

TaskWho
Register applications, manage keys and Allowed URLsAuthfy administrator
Create companies, manage members, subscriptions, categoriesAuthfy administrator (or your backend, via the Management API)
Sign users in, verify tokens, read directory dataYour application
Send transactional email/SMSYour application, via the notification API

If you need something changed that isn't covered by the APIs here — a new application registration, a key reset, enabling a notification channel — contact your Authfy administrator.