errors
AdapterErrorβ
One of the database Adapter
methods
failed during execution.
If debug: true
is set, you can check out [auth][debug]
in the logs to learn more about the failed adapter method execution.
Exampleβ
[auth][debug]: adapter_getUserByEmail
{ "args": [undefined] }
Extendsβ
Propertiesβ
typeβ
type:
ErrorType
The error type. Used to identify the error in the logs.
Inherited fromβ
AuthErrorβ
Base error class for all Auth.js errors.
It's optimized to be printed in the server logs in a nicely formatted way
via the logger.error
option.
Extendsβ
Error
Propertiesβ
typeβ
type:
ErrorType
The error type. Used to identify the error in the logs.
AuthorizedCallbackErrorβ
Thrown when the execution of the signIn
callback fails
or if it returns false
.
Extendsβ
Propertiesβ
typeβ
type:
ErrorType
The error type. Used to identify the error in the logs.
Inherited fromβ
CallbackRouteErrorβ
This error occurs when the user cannot finish login. Depending on the provider type, this could have happened for multiple reasons.
Check out [auth][details]
in the logs to know which provider failed.
Exampleβ
[auth][details]: { "provider": "github" }
For an OAuth provider, possible causes are:
- The user denied access to the application
- There was an error parsing the OAuth Profile:
Check out the provider's
profile
oruserinfo.request
method to make sure it correctly fetches the user's profile. - The
signIn
orjwt
callback methods threw an uncaught error: Check the callback method implementations.
For an Email provider, possible causes are:
- The provided email/token combination was invalid/missing:
Check if the provider's
sendVerificationRequest
method correctly sends the email. - The provided email/token combination has expired: Ask the user to log in again.
- There was an error with the database: Check the database logs.
For a Credentials provider, possible causes are:
- The
authorize
method threw an uncaught error: Check the provider'sauthorize
method. - The
signIn
orjwt
callback methods threw an uncaught error: Check the callback method implementations.
Check out [auth][cause]
in the error message for more details.
It will show the original stack trace.
Extendsβ
Propertiesβ
typeβ
type:
ErrorType
The error type. Used to identify the error in the logs.
Inherited fromβ
CredentialsSigninβ
The authorize
callback returned null
in the Credentials provider.
We don't recommend providing information about which part of the credentials were wrong, as it might be abused by malicious hackers.
Extendsβ
SignInError
Propertiesβ
typeβ
type:
ErrorType
The error type. Used to identify the error in the logs.
Inherited fromβ
SignInError.type
EmailSignInErrorβ
Happens when the login by an Email provider could not be started.
Possible causes are:
- The email sent from the client is invalid, could not be normalized by
EmailConfig.normalizeIdentifier
- The provided email/token combination has expired: Ask the user to log in again.
- There was an error with the database: Check the database logs.
Extendsβ
SignInError
Propertiesβ
typeβ
type:
ErrorType
The error type. Used to identify the error in the logs.
Inherited fromβ
SignInError.type
ErrorPageLoopβ
Thrown when Auth.js is misconfigured and accidentally tried to require authentication on a custom error page. To prevent an infinite loop, Auth.js will instead render its default error page.
To fix this, make sure that the error
page does not require authentication.
Learn more at Guide: Error pages
Extendsβ
Propertiesβ
typeβ
type:
ErrorType
The error type. Used to identify the error in the logs.
Inherited fromβ
EventErrorβ
One of the events
methods
failed during execution.
Make sure that the events
methods are implemented correctly and uncaught errors are handled.
Learn more at events
Extendsβ
Propertiesβ
typeβ
type:
ErrorType
The error type. Used to identify the error in the logs.
Inherited fromβ
InvalidCallbackUrlβ
Thrown when Auth.js is unable to verify a callbackUrl
value.
The browser either disabled cookies or the callbackUrl
is not a valid URL.
Somebody might have tried to manipulate the callback URL that Auth.js uses to redirect the user back to the configured callbackUrl
/page.
This could be a malicious hacker trying to redirect the user to a phishing site.
To prevent this, Auth.js checks if the callback URL is valid and throws this error if it is not.
There is no action required, but it might be an indicator that somebody is trying to attack your application.
Extendsβ
Propertiesβ
typeβ
type:
ErrorType
The error type. Used to identify the error in the logs.
Inherited fromβ
InvalidCheckβ
Thrown when a PKCE, state or nonce OAuth check could not be performed. This could happen if the OAuth provider is configured incorrectly or if the browser is blocking cookies.
Learn more at checks
Extendsβ
Propertiesβ
typeβ
type:
ErrorType
The error type. Used to identify the error in the logs.
Inherited fromβ
InvalidEndpointsβ
One of the configured OAuth or OIDC providers is missing the authorization
, token
or userinfo
, or issuer
configuration.
To perform OAuth or OIDC sign in, at least one of these endpoints is required.
Learn more at OAuth2Config
or Guide: OAuth Provider
Extendsβ
Propertiesβ
typeβ
type:
ErrorType
The error type. Used to identify the error in the logs.
Inherited fromβ
InvalidProviderβ
Thrown when the callback endpoint was incorrectly called without a provider.
Extendsβ
Propertiesβ
typeβ
type:
ErrorType
The error type. Used to identify the error in the logs.
Inherited fromβ
JWTSessionErrorβ
Logged on the server when Auth.js could not decode or encode a JWT-based (strategy: "jwt"
) session.
Possible causes are either a misconfigured secret
or a malformed JWT or encode/decode
methods.
When this error is logged, the session cookie is destroyed.
Learn more at secret
, jwt.encode
or jwt.decode
for more information.
Extendsβ
Propertiesβ
typeβ
type:
ErrorType
The error type. Used to identify the error in the logs.
Inherited fromβ
MissingAdapterβ
Thrown if Auth.js is misonfigured. This could happen if you configured an Email provider but did not set up a database adapter,
or tried using a strategy: "database"
session without a database adapter.
In both cases, make sure you either remove the configuration or add the missing adapter.
Learn more at Database Adapters, Email provider or Concept: Database session strategy
Extendsβ
Propertiesβ
typeβ
type:
ErrorType
The error type. Used to identify the error in the logs.
Inherited fromβ
MissingAdapterMethodsβ
Thrown similarily to MissingAdapter
, but only some required methods were missing.
Make sure you either remove the configuration or add the missing methods to the adapter.
Learn more at Database Adapters
Extendsβ
Propertiesβ
typeβ
type:
ErrorType
The error type. Used to identify the error in the logs.
Inherited fromβ
MissingAuthorizeβ
Thrown when a Credentials provider is missing the authorize
configuration.
To perform credentials sign in, the authorize
method is required.
Learn more at Credentials provider
Extendsβ
Propertiesβ
typeβ
type:
ErrorType
The error type. Used to identify the error in the logs.
Inherited fromβ
MissingCSRFβ
Error for missing CSRF tokens in client-side actions (signIn
, signOut
, useSession#update
).
Thrown when actions lack the double submit cookie, essential for CSRF protection.
CSRF (Cross-Site Request Forgery) is an attack leveraging authenticated user credentials for unauthorized actions.
Double submit cookie pattern, a CSRF defense, requires matching values in a cookie and request parameter. More on this at MDN Web Docs.
Extendsβ
SignInError
Propertiesβ
typeβ
type:
ErrorType
The error type. Used to identify the error in the logs.
Inherited fromβ
SignInError.type
MissingSecretβ
Auth.js requires a secret to be set, but none was not found. This is used to encrypt cookies, JWTs and other sensitive data.
If you are using a framework like Next.js, we try to automatically infer the secret from the AUTH_SECRET
environment variable.
Alternatively, you can also explicitly set the AuthConfig.secret
.
You can generate a good secret value:
- On Unix systems: type
openssl rand -hex 32
in the terminal - Or generate one online
Extendsβ
Propertiesβ
typeβ
type:
ErrorType
The error type. Used to identify the error in the logs.
Inherited fromβ
OAuthAccountNotLinkedβ
Thrown when an Email address is already associated with an account but the user is trying an OAuth account that is not linked to it.
For security reasons, Auth.js does not automatically link OAuth accounts to existing accounts if the user is not signed in.
If you trust the OAuth provider to have verified the user's email address,
you can enable automatic account linking by setting allowDangerousEmailAccountLinking: true
in the provider configuration.
Extendsβ
SignInError
Propertiesβ
typeβ
type:
ErrorType
The error type. Used to identify the error in the logs.
Inherited fromβ
SignInError.type
OAuthCallbackErrorβ
Thrown when an OAuth provider returns an error during the sign in process. This could happen for example if the user denied access to the application or there was a configuration error.
For a full list of possible reasons, check out the specification Authorization Code Grant: Error Response