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.

The client from Getting started sets a few options and leaves the rest to their defaults. When your app outgrows them, because your backend sends tokens differently, sessions must last longer, or you need to see why a user was signed out, the options passed to createAuth are where you change it.

This page lists every option, and the pages in this section explain each part of the client in turn.

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, the user is signed out when the access token expires or your API rejects it.
revokeNoRevokes the ended tokens on your backend after a sign-out.
maxAgeNoHow long a saved session lasts, in seconds. Default: 30 days, counted 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 when it can't use an option, 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.

Next steps

  • Refresh: check that your refresh callback tells a rejected token from an outage.
  • Storage: choose where the session is saved, and for how long.
  • Errors: show failed refreshes and storage problems to your users.

On this page