Skip to main content
A single-page app runs entirely in the browser, so it can’t keep a secret. It signs people in with the authorization code flow and PKCE, and calls Aiveth’s token endpoint itself. Aiveth allows those browser calls only from the web origins of apps you registered.

Register a browser app

1

Register the app

In the console, open Apps → Register app. Under Kind, choose Browser or mobile app.
2

Add your callback page

Under Return addresses, add your callback page, for example https://app.acme.com/callback. In your Development environment you can use http://localhost:5173/callback.
3

Copy the client ID

A browser app has no secret. The credentials screen says: “No secret: this app proves itself with PKCE on every sign-in.”

Registered web origins

Aiveth answers cross-origin (CORS) requests from a browser only when all of these are true:
  • The path is one of these: /oauth/token, /oauth/userinfo, /oauth/revoke, /.well-known/openid-configuration and /v1/auth/.well-known/jwks.json. Never the sign-in page or any other API.
  • The origin belongs to a public app. The origin is the scheme, host and port of one of the return addresses of an active app without a secret. A server app’s return addresses don’t count; a server app never needs the browser to call Aiveth.
  • No credentials. Aiveth never sends Access-Control-Allow-Credentials, so the browser never sends Aiveth’s cookies along. Each call carries its own code or token.
The allowed methods are GET and POST, and the allowed request headers are Authorization, Content-Type and DPoP. Preflight answers may be cached for 10 minutes. A request from any other origin gets no CORS headers at all, so the browser blocks it. There is no separate “allowed origins” list to fill in: the return addresses are the list. A new app’s origin works within about a minute.

Use the React SDK

The React SDK runs the whole flow for you.
  • Sign-in happens on Aiveth’s page, with code and PKCE.
  • Tokens are kept in memory, never in localStorage. After a reload, signIn() comes straight back while the person is still signed in at Aiveth.
  • The SDK asks for offline_access by default and swaps the refresh token at every use.
  • An app belongs to one organization, so there is no organization switcher.

Without the SDK

Any OpenID Connect library for browsers works. The token request from a public app sends client_id in the form body and no client_secret:
A public app must not send a secret. If it does, Aiveth answers invalid_client.

Security notes

  • Keep tokens in memory. Don’t put them in localStorage or sessionStorage.
  • Always check state on the callback, and nonce in the ID token.
  • Consider DPoP: it binds the tokens to a key held by the browser, so a copied token is useless. A public app’s refresh tokens are bound too.