-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
[JWT] Using database still uses JWT strategy and gives a JWTSessionError #11510
Comments
This comment was marked as off-topic.
This comment was marked as off-topic.
Hi, the code snippet/reproduction does not match fully, as in #11510 (comment), Judging from this, the problem is that outside Middleware, you expect to use database sessions, while inside, you expect to use JWT sessions. The two cannot be used at the same time. The database session strategy creates a session cookie that is not a valid JWE, hence the error being thrown. So this is expected. |
I used it to get rid of the error, I followed this documentation for edge compatibility, I want it to just have the database strategy not jwt altogether, What I did wrong ? |
you must remove jwt callback function |
I have the same problem. I'm using the split config from here and not using edge Changing auth.config.ts
auth.ts
middleware.ts
The code works and recover the role property from database, but previously show this error in console
|
In my case I got less error detail from JWTSessionError because I try to access null object. Entire error I got
"next": "15.0.3",
|
Environment
Reproduction URL
https://github.com/A1X5H04/notesync-web
Describe the issue
I am getting the following JWT Session Error when using a database strategy, this only occurs when using a database strategy,
auth.ts
auth.config.ts
Here's the error I am getting:
And yes, I don't have malformed secret configured, and I also have pass a string from the .env to the secret key in auth config, I have also not touched any jwt function in the library
How to reproduce
Expected behavior
Should create a session in the database and authenticate the user and redirect them to designated route, without any error, and should use database approach
The text was updated successfully, but these errors were encountered: