Errors
This is a list of errors output from NextAuth.js.
All errors indicate an unexpected problem, you should not expect to see errors.
If you are seeing any of these errors in the console, something is wrong.
Clientβ
These errors are returned from the client. As the client is Universal JavaScript (or "Isomorphic JavaScript") it can be run on the client or server, so these errors can occur in both in the terminal and in the browser console.
CLIENT_USE_SESSION_ERRORβ
This error occurs when the useSession()
React Hook has a problem fetching session data.
CLIENT_FETCH_ERRORβ
If you see CLIENT_FETCH_ERROR
make sure you have configured the NEXTAUTH_URL
environment variable.
Serverβ
These errors are displayed on the terminal.
OAuthβ
OAUTH_GET_ACCESS_TOKEN_ERRORβ
OAUTH_V1_GET_ACCESS_TOKEN_ERRORβ
OAUTH_GET_PROFILE_ERRORβ
OAUTH_PARSE_PROFILE_ERRORβ
OAUTH_CALLBACK_HANDLER_ERRORβ
Signin / Callbackβ
GET_AUTHORIZATION_URL_ERRORβ
SIGNIN_OAUTH_ERRORβ
CALLBACK_OAUTH_ERRORβ
SIGNIN_EMAIL_ERRORβ
CALLBACK_EMAIL_ERRORβ
EMAIL_REQUIRES_ADAPTER_ERRORβ
The Email authentication provider can only be used if a database is configured.
CALLBACK_CREDENTIALS_JWT_ERRORβ
The Credentials Provider can only be used if JSON Web Tokens are used for sessions.
JSON Web Tokens are used for Sessions by default if you have not specified a database. However if you are using a database, then Database Sessions are enabled by default and you need to explicitly enable JWT Sessions to use the Credentials Provider.
If you are using a Credentials Provider, NextAuth.js will not persist users or sessions in a database - user accounts used with the Credentials Provider must be created and managed outside of NextAuth.js.
In most cases it does not make sense to specify a database in NextAuth.js options and support a Credentials Provider.
CALLBACK_CREDENTIALS_HANDLER_ERRORβ
PKCE_ERRORβ
The provider you tried to use failed when setting PKCE or Proof Key for Code Exchange.
The code_verifier
is saved in a cookie called (by default) __Secure-next-auth.pkce.code_verifier
which expires after 15 minutes.
Check if cookies.pkceCodeVerifier
is configured correctly. The default code_challenge_method
is "S256"
. This is currently not configurable to "plain"
, as it is not recommended, and in most cases it is only supported for backward compatibility.
Session Handlingβ
JWT_SESSION_ERRORβ
https://next-auth.js.org/errors#jwt_session_error JWKKeySupport: the key does not support HS512 verify algorithm
The algorithm used for generating your key isn't listed as supported. You can generate a HS512 key using
jose newkey -s 512 -t oct -a HS512
If you are unable to use an HS512 key (for example to interoperate with other services) you can define what is supported using
jwt: {
signingKey: {"kty":"oct","kid":"--","alg":"HS256","k":"--"},
verificationOptions: {
algorithms: ["HS256"]
}
}
SESSION_ERRORβ
Signoutβ
SIGNOUT_ERRORβ
Databaseβ
These errors are logged by the TypeORM Adapter, which is the default database adapter.
They all indicate a problem interacting with the database.
ADAPTER_CONNECTION_ERRORβ
CREATE_USER_ERRORβ
GET_USER_BY_ID_ERRORβ
GET_USER_BY_EMAIL_ERRORβ
GET_USER_BY_PROVIDER_ACCOUNT_ID_ERRORβ
LINK_ACCOUNT_ERRORβ
CREATE_SESSION_ERRORβ
GET_SESSION_ERRORβ
UPDATE_SESSION_ERRORβ
DELETE_SESSION_ERRORβ
CREATE_VERIFICATION_REQUEST_ERRORβ
GET_VERIFICATION_REQUEST_ERRORβ
DELETE_VERIFICATION_REQUEST_ERRORβ
Otherβ
SEND_VERIFICATION_EMAIL_ERRORβ
This error occurs when the Email Authentication Provider is unable to send an email.
Check your mail server configuration.
MISSING_NEXTAUTH_API_ROUTE_ERRORβ
This error happens when [...nextauth].js
file is not found inside pages/api/auth
.
Make sure the file is there and the filename is written correctly.