Early access: Company Sign-In is not live in production yet. Fluid enables it per company. Until it is enabled for your company, discovery and app registration return
404. Contact your Fluid representative or Fluid support to request early access.openid-client), running the Authorization Code flow with PKCE (S256), state, and nonce, reading /userinfo, and renewing sessions with prompt=none.
Before you start
- Confirm that Fluid has enabled Company Sign-In for your company.
- Have a signed-in company administrator with the
developer.updatepermission ready to register the app. - Decide on your app’s callback URL (for example,
https://portal.northwind.example/callbackin production orhttp://localhost:3000/callbacklocally).
1
Register your app
A company administrator manages apps through the company-apps API on The Store
api.fluid.app using their signed-in admin Bearer token (Authorization: Bearer <token>):POST .../company-appsregisters an app (requiresdeveloper.update).GET .../company-appslists apps with cursor pagination viapage[cursor]andmeta.pagination.next_cursor(requiresdeveloper.view).POST .../company-apps/{client_id}/revokerevokes an app (requiresdeveloper.update).
api.fluid.app when enabling early access for your company, and the full operations will appear in the API Reference on release. Machine credentials (company API tokens, partner tokens, public tokens, and droplet installation tokens) are refused with 403 — only a signed-in company admin can manage Company Sign-In apps.Send these fields when creating an app:Where
<company-slug> comes from: Fluid creates your company’s issuer URL (https://identity.fluid.app/c/<company-slug>) when you register your first app. By default, <company-slug> is your company’s Fluid subdomain in lowercase. You can pass a custom issuer_slug on that first registration as a lowercase DNS label (1 to 63 characters: a-z, 0-9, and inner hyphens -). Once set, your company’s issuer slug never changes.Redirect URI rules:- Must use
https://, excepthttp://localhost:<port>/...orhttp://127.0.0.1:<port>/...with an explicit port for local development. - No wildcards (
*), fragments (#), user info (user:pass@), backslashes, or whitespace. - Matched byte for byte at both
/authorizeand/token.
201 response returns a company_app object with everything your app needs:client_id and issuer in your app’s environment configuration. Public apps have no client secret.2
Configure a stock OpenID Connect library
Install Configure discovery using your company’s issuer URL and your app’s Other stock OpenID Connect libraries — such as
openid-client (v6 or later):client_id. Because discovery advertises ES256 signing, PKCE S256, and your company’s endpoints under /c/<company-slug>/, stock library defaults work with no algorithm overrides:lib/oidc.ts
oauth4webapi (Auth.js v5) and go-oidc — also work with standard discovery from https://identity.fluid.app/c/<company-slug>. Always rely on discovery rather than hard-coding endpoint URLs.3
Start the sign-in flow with PKCE, state, and nonce
Generate a fresh PKCE Save
code_verifier, S256 code_challenge, state, and nonce on your server before redirecting the browser. Both state and PKCE S256 are required; omitting state or sending plain returns HTTP 400.lib/oidc.ts
flow ({ codeVerifier, state, nonce }) in a short-lived (for example, 10-minute), encrypted, HttpOnly, Secure cookie with SameSite=Lax, then redirect the browser to url.4
Handle the callback and read userinfo
When Fluid redirects back to your Create your app’s own encrypted
redirect_uri:- Read and clear the flow cookie. If it is missing or expired, show a timeout message and let the person sign in again.
- Check whether the query string carries an
errorparameter (such aslogin_requiredafter a silent renewal ortemporarily_unavailable). - Build the callback URL from your configured
redirectUriplus the incoming query string so theredirect_urisent to/tokenmatches the registered URI byte for byte. - Exchange the code with
authorizationCodeGrant, which authenticates the token endpoint over HTTPS and validatesiss,aud,exp,state, andnonce. (Passoidc.enableNonRepudiationChecksindiscoveryoptions if you also wantopenid-clientto verify theES256signature against JWKS on back-channel token responses.) - Call
fetchUserInfoon your server to read the person’s live profile and Fluid membership claims.
lib/oidc.ts
HttpOnly session cookie using the returned claims:- Key users by
(issuer, subject). Never key users byemail, because email addresses can change. Never link an existing local account byemailunlessemail_verifiedistrue. - Cap your session cookie lifetime to
expiresIn(at most 10 minutes). Because early access has no refresh tokens or sign-out notifications yet, capping your app session toexpiresInkeeps your app in sync with Fluid sign-outs. - Keep
accessTokenon your server. Never expose it to browser JavaScript, and never send it to the Fluid API.
5
Renew sessions silently with prompt=none
Access tokens and ID tokens expire after 10 minutes (
expires_in: 600 by default). People do not have to sign in again every 10 minutes.When your app’s session cookie expires on a page navigation, redirect the browser to your authorization endpoint with prompt: "none":- If the person’s Fluid session is still active and valid for your company, Fluid redirects straight back to your callback with a fresh
codeand no sign-in screen. - If the person signed out of Fluid or lost membership at your company, Fluid redirects back with
error=login_required. Clear any local state and treat the person as signed out.
Next steps
Read the Company Sign-In reference for the full list of endpoints, scopes, claims,email_verified rules, error codes, and sign-out behavior.