Skip to Content
Configuring the client

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:

OptionRequiredWhat it sets
nameYesNames the saved session and the refresh lock: letters, digits, _ or -, up to 64 characters. Keeps two apps on one origin apart.
userYesA user schema, or fromAccessToken.
storageYesWhere the session is saved.
refreshNoHow to get new tokens. Without it, an expired token signs the user out.
revokeNoRevokes the ended tokens on your backend after a sign-out.
maxAgeNoHow long a saved session can be restored, in seconds. Default: 30 days, counted again from each save.
debugNoReports what the client does. Default: off.
lockingNoRestores a saved session as locked, for native apps. Default: off.

createAuth throws an AuthError with the code INVALID_OPTIONS for an option it can't use, such as a name with other characters, or a maxAge that isn't a positive whole number.

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.

On this page