Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: rename session strategy #3144

Merged
merged 2 commits into from
Nov 7, 2021
Merged

Conversation

balazsorban44
Copy link
Member

@balazsorban44 balazsorban44 commented Nov 7, 2021

This PR makes it hopefully more clear how the user can use the different session strategies.

  1. No adapter, strategy: "jwt": This is the default. The session is saved in a cookie and never persisted anywhere.
  2. With Adapter, strategy: "database": If an Adapter is defined, this will be the implicit setting. No user config is needed.
  3. With Adapter, strategy: "jwt": The user can explicitly instruct next-auth to use JWT even if a database is available. This can result in faster lookups in compromise of lowered security. Read more about: https://next-auth.js.org/faq#json-web-tokens

Docs: nextauthjs/docs#105

Copy link
Collaborator

@ubbe-xyz ubbe-xyz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯

@balazsorban44 balazsorban44 merged commit ba39efb into beta Nov 7, 2021
@balazsorban44 balazsorban44 deleted the feat/rename-session-strategy branch November 7, 2021 20:06
@zigang93
Copy link

still get CALLBACK_CREDENTIALS_JWT_ERROR ,
even I already set the strategy to jwt

session: {
    strategy: 'jwt',
  },

@davecarlson
Copy link

Same as above, unable to get a csrf token:

[next-auth][error][CALLBACK_CREDENTIALS_JWT_ERROR]
https://next-auth.js.org/errors#callback_credentials_jwt_error Signin in with credentials only supported if JWT strategy is enabled UnsupportedStrategy [UnsupportedStrategyError]: Signin in with credentials only supported if JWT strategy is enabled

@aokigit
Copy link

aokigit commented Nov 17, 2021

Having the exact same problem as the two people above me. Tried both the old and new strategy way and always receiving the CALLBACK_CREDENTIALS_JWT_ERROR error.

@balazsorban44
Copy link
Member Author

Addressed already.

#3216 reported this, the fix has landed, release coming 🔜. Use the version here ttps://github.com//pull/3217#issuecomment-970646869 or patch-package if you cannot wait.

@rabin-nyaundi
Copy link

rabin-nyaundi commented Nov 26, 2021

I'm having the same issue with next-auth v4.

[next-auth][error][CALLBACK_CREDENTIALS_JWT_ERROR] 
https://next-auth.js.org/errors#callback_credentials_jwt_error Signin in with credentials only supported if JWT strategy is enabled UnsupportedStrategy [UnsupportedStrategyError]: Signin in with credentials only supported if JWT strategy is enabled

even after setting

session:{
      strategy: 'jwt'
}

@renchris
Copy link

Is there a way to use next-auth for using jwt tokens in session storage but not using it nor including a provider for user login authentication?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Refers to `@auth/core`
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants