Replies: 1 comment
-
It appears that this runs only on the very first request to the application. How can I ensure it runs on every request? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Edit: see reproducible source: https://github.com/rudfoss/next-server-custom-req
I'm implementing OpenID Connect with express + passport + nextjs and I'm trying to let every page in my app know the authentication state of the user (+ all claim information). In previous projects I've done this through dumping parts of the
req.session
data to the page, picking it up on the client and using it for whatever I need. However I'm unsure on how to do this correctly using NextJS.I've read a lot of documentation and discussions (including this) on how to read the
req
object, but nothing seems to consistently work. All I want to do is get data fromreq.user
(aka.req.session.passport.user
) to the client.I've tried modifying
_document
to return the data.Is there a way to consistently dump
req.user
to all pages? I don't care about deoptimization.Beta Was this translation helpful? Give feedback.
All reactions