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
I am using the App Router. This code works when placed inside the component folder as app/trials/route.ts but gives 401 unauthorized when used as a route handler at app/api/trials/route.ts
GET /trials 200 in 317ms
GET /api/auth/me 200 in 9ms
GET /api/auth/me 200 in 5ms
GET /api/trials 401 in 5ms
Response {
[Symbol(realm)]: null,
[Symbol(state)]: {
aborted: false,
rangeRequested: false,
timingAllowPassed: true,
requestIncludesCredentials: true,
type: 'default',
status: 401,
timingInfo: {
startTime: 27883.867709,
redirectStartTime: 0,
redirectEndTime: 0,
postRedirectStartTime: 27883.867709,
finalServiceWorkerStartTime: 0,
finalNetworkResponseStartTime: 0,
finalNetworkRequestStartTime: 0,
endTime: 0,
encodedBodySize: 110,
decodedBodySize: 110,
finalConnectionTimingInfo: null
},
cacheState: '',
statusText: 'Unauthorized',
headersList: HeadersList {
cookies: null,
[Symbol(headers map)]: [Map],
[Symbol(headers map sorted)]: null
},
urlList: [ URL {} ],
body: { stream: undefined }
},
[Symbol(headers)]: HeadersList {
cookies: null,
[Symbol(headers map)]: Map(6) {
'vary' => [Object],
'content-type' => [Object],
'date' => [Object],
'connection' => [Object],
'keep-alive' => [Object],
'transfer-encoding' => [Object]
},
[Symbol(headers map sorted)]: null
}
}
GET /trials 200 in 136ms
GET /api/auth/me 200 in 6ms
GET /api/auth/me 200 in 4ms
There just isn't any good documentation on doing this with the App Router and with the nextjs-auth0 library. Any guess what I'm doing wrong? I was expecting to be able to attach the token and keep everything server rendered. Thanks!
Checklist
Description
I am using the App Router. This code works when placed inside the component folder as
app/trials/route.ts
but gives401 unauthorized
when used as a route handler atapp/api/trials/route.ts
In the server logs...
There just isn't any good documentation on doing this with the App Router and with the nextjs-auth0 library. Any guess what I'm doing wrong? I was expecting to be able to attach the token and keep everything server rendered. Thanks!
Reproduction
Additional context
No response
nextjs-auth0 version
3.5.0
Next.js version
14.2.3
Node.js version
20.11.0
The text was updated successfully, but these errors were encountered: