Confused where the session in the provider is coming #2530
-
Hello, just want to ask something because I'm confused. Pardon me. In the examples, like https://github.com/nextauthjs/next-auth-example, the import { Provider } from "next-auth/client"
import type { AppProps } from "next/app"
export default function App({ Component, pageProps }: AppProps) {
return (
<Provider
session={pageProps.session}
>
<Component {...pageProps} />
</Provider>
)
} How does |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
no, you aren't. it's a tradeoff. we can't magically make the session appear so it has to come from getInitialProps or getServerSideProps. if it's not passed, we fetch it from the client at initialization, but you will have to accommodate for the initial load Ref: https://next-auth.js.org/getting-started/client#provider |
Beta Was this translation helpful? Give feedback.
no, you aren't. it's a tradeoff. we can't magically make the session appear so it has to come from getInitialProps or getServerSideProps. if it's not passed, we fetch it from the client at initialization, but you will have to accommodate for the initial load
Ref: https://next-auth.js.org/getting-started/client#provider