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
Redirects to signin page using Next.js v13.4.12, adapter and session strategy: database #8161
Comments
I am having the same issue as you. I did notice in your code you didn't have SessionProvider context though. Not sure if you missed that in the example only. Otherwise have you found a solution. |
Same issue here. Have you found any workaroud? |
I'm still trying to figure out the issue with limited time. Yet to try previous next Auth version. Does appear this has been an issue in the past too. To clarify I am using App directory and middleware. I think it works without the middleware from memory. |
@tmackness I think this all happened on server-side, the route simply redirects with 307 to signin page without any client-side js being executed, and |
Isn't that a documented limitation? From https://next-auth.js.org/configuration/nextjs#caveats:
|
I have the same issue with using |
damn its been driving me crazy.... just went and look at the middleware code, it just support |
There is no workaround. The middleware only supports jwt sessions. I added this prerequisite to the docs with #10667. |
The reason that caveat was added back in the old docs is no longer accurate - many database adapters are "edge compatible", meaning you can use the database adapters / database sessions with middleware now. See:
That of course doesn't mean all database adapters will work, you have to double check that your database runs in an edge runtime, aka not using node.js. I'm going to close this issue as we've seemingly figured out the main issue and there is newer info available ^^ |
@ndom91 , sorry to ask it here, where would you augment user data session, since we dont have a token which hold additional information. is this pattern ok ?
|
Environment
System:
OS: Linux 6.4 Arch Linux
CPU: (16) x64 12th Gen Intel(R) Core(TM) i5-12600KF
Memory: 6.50 GB / 62.66 GB
Container: Yes
Shell: 3.6.1 - /usr/bin/fish
Binaries:
Node: 16.17.1 - ~/.local/share/nvm/v16.17.1/bin/node
Yarn: 1.22.19 - ~/.local/share/nvm/v16.17.1/bin/yarn
npm: 8.15.0 - ~/.local/share/nvm/v16.17.1/bin/npm
pnpm: 6.7.1 - ~/.local/share/nvm/v16.17.1/bin/pnpm
Reproduction URL
https://github.com/std4453/next-auth-bug/
Describe the issue
next-auth
does not work when:next.js
v13.4.12 (other versions not tested)database
as session strategyWhen entering
/
, it jumps to/api/auth/signin
, you login, it jumps back to/api/auth/callback/keycloak
, then to/
, then to/api/auth/signin
again.As a result, you never get to use the app.
It works when using
jwt
as session strategy.I'm not sure whether this is a duplicate of #5008 , that one claims to be fixed in Next.js
v12.2.5-canary.2
or newer, yet there has since been more feedback about it not working, and it might be worth to take another look.How to reproduce
See
README
.Expected behavior
It should redirect to the OAuth provider, then back to the app, and you should be able to use it.
The text was updated successfully, but these errors were encountered: