Configuring the client
Every option createAuth takes, with a page for each part of the client you can configure.
createAuth builds the client from a few options. This section explains each
one, for when the defaults in Getting started no
longer fit your app.
Options
createAuth takes three required options and five optional ones:
| Option | Required | What it sets |
|---|---|---|
name | Yes | The storage namespace: letters, digits, _ or -. Keeps two apps on one origin apart. |
user | Yes | A user schema, or fromAccessToken. |
storage | Yes | Where the session is saved. |
refresh | No | How to get new tokens. Without it, an expired token signs the user out. |
revoke | No | Revokes the ended tokens on your backend after a sign-out. |
maxAge | No | How long a saved session can be restored, in seconds. Default: 30 days, counted again from each save. |
debug | No | Reports what the client does. Default: off. |
locking | No | Restores a saved session as locked, for native apps. Default: off. |
Pages in this section
Each page covers one part of the client: how it checks users, gets new tokens, saves the session, follows other tabs, and reports what happens.
- User schemasWhen the schema checks users, and the rules restoring a session sets for it.
- RefreshWhat the refresh callback returns, and when a refresh runs.
- ExpiryHow the client finds out when the access token expires.
- StorageWhere the session is saved: localStorage, sessionStorage, the device, or your own store.
- TabsHow tabs follow each other's sign-ins, and share one refresh.
- ErrorsEvery AuthError code, and the failures that need a decision from you.
- DebuggingLog what the client does, or send it to your error reporting.