You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The code above is just an example of what I've tried, but the same error occurs even if I do it like this:
export{default}from"next-auth/middleware"
Throughout the whole app I retrieve the token with a getSession function, which cannot be used in the middleware. From what I read you can use getToken function as an alternative, however that also doesn't work for me, as I get the same error as described here, when I use this code:
All of that makes me believe that I might've setup something wrong inside of the [...nextauth].ts file, but can't really point it out myself. My guess is that I', probably juggling around between jwt and database session strategy, which would explain the lack of the token (I might be wrong though).
If the user is not authorized by Spotify they should be redirected by middleware into '/login' route. If they are however, they should be able to use the other routes.
The text was updated successfully, but these errors were encountered:
dawidseipold
added
the
triage
Unseen or unconfirmed by a maintainer yet. Provide extra information in the meantime.
label
Aug 6, 2022
Environment
System:
OS: Windows 10 10.0.22000
CPU: (4) x64 Intel(R) Core(TM) i5-6600K CPU @ 3.50GHz
Memory: 17.66 GB / 31.91 GB
Binaries:
Node: 16.13.2 - C:\Program Files\nodejs\node.EXE
Yarn: 1.22.17 - ~\AppData\Roaming\npm\yarn.CMD
npm: 8.1.2 - C:\Program Files\nodejs\npm.CMD
Browsers:
Edge: Spartan (44.22000.120.0)
Internet Explorer: 11.0.22000.120
npmPackages:
next: latest => 12.2.3
next-auth: ^4.10.3 => 4.10.3
react: 18.1.0 => 18.1.0
Reproduction URL
https://github.com/dawidseipold/melsea
Describe the issue
Hi! I have a problem with setting up the middleware for the next-auth.
No matter what I put inside of the
withAuth
function, I get the same error whenever I go to a configured matching route.GET http://localhost:3000/api/auth/error?error=Configuration 500 (Internal Server Error)
The code above is just an example of what I've tried, but the same error occurs even if I do it like this:
Throughout the whole app I retrieve the token with a
getSession
function, which cannot be used in the middleware. From what I read you can usegetToken
function as an alternative, however that also doesn't work for me, as I get the same error as described here, when I use this code:All of that makes me believe that I might've setup something wrong inside of the
[...nextauth].ts
file, but can't really point it out myself. My guess is that I', probably juggling around betweenjwt
anddatabase
session strategy, which would explain the lack of the token (I might be wrong though).[...nextauth].ts
How to reproduce
[...nextauth].ts
as abovemiddleware.ts
as aboveExpected behavior
If the user is not authorized by Spotify they should be redirected by middleware into
'/login'
route. If they are however, they should be able to use the other routes.The text was updated successfully, but these errors were encountered: