Skip to main content

Core

In this document you can find more information on each of the configuration options available in createAuth() method.

createAuth()optionalfunctionusage

The createAuth() function is used to create an instance of the Auth module. It accepts an object with configuration properties. You can see below the a full list.


autoCreateoptionalbooleanusage

Default: true


identityFieldrequiredstringusage

Field name that will be used to map your Authenticated Item to the Auth database.


keystonePathoptionalstring

Path to your Keystone admin panel.


listKeyrequiredstringusage

Name of the Keystone List that will be used to store the Authenticated Item. For example, "User".


onSignInoptionalasync function

Useful for operations that needs to be run when a user logs into their account.

With this method we return query and provider return data. These two return values will give you full flexibility to interact with Keystone DB via GraphQL query and provider data.


onSignUpoptionalasync function

Useful for operations that needs to be run when user first signs up. For example, you can use this to create a new user in your database if they don't exist.

Maps the table in your database to the authenticatedItem.


pagesoptionalobject

Allows you to customize the pages that are rendered by the callbacks. See Pages options for usage.


providersrequiredarrayusage

For now, please refer to NextAuth Providers.


sessionDatarequiredgraphql query string

Defines what data will be returned in the session object when user is authenticated.


sessionSecretrequiredstring

String used to encrypt your users' sessions.


...restoptionalKeystone options

Since createAuth() is a wrapper, so - it accepts all Keystone options too. For more information, refer to Keystone auth options.