getServerSession error on getInitialProps #4068
-
Environment
Reproduction URLhttps://github.com/rizchaerul/get-server-session Describe the issueI tried here's the code:
How to reproduceJust run Expected behaviorI expect |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
getInitialProps also runs in the browser, so it's not possible, no. You can rather try our Middleware instead to lock down the entire app in a single line
export { default } from "next-auth/middleware" |
Beta Was this translation helpful? Give feedback.
-
@balazsorban44 Since Next JS v12 removed Doing it on every page is nice, but that is a lot of copy and paste and it would be cleaner to centralize this logic. |
Beta Was this translation helpful? Give feedback.
getInitialProps also runs in the browser, so it's not possible, no.
You can rather try our Middleware instead to lock down the entire app in a single line
pages/_middleware.js