cannot read undefined session.status
Answered
Hoopoe posted this in #help-forum
HoopoeOP
Code:
const session = useSession({
required: true,
});
if (!data || session?.status !== "authenticated") return <>Loading...</>;
return (....)
17 Replies
HoopoeOP
anyone
@Hoopoe this is in `next build`
need a larger code sample
HoopoeOP
welp, i found out that the issue was i didn't use SessionProvider
Answer
https://github.com/nextauthjs/next-auth-v5-example/blob/main/app/client-example/page.tsx
Are you providing a Session provider to that component?
Are you providing a Session provider to that component?
check that repo out it has a bunch of helpful stuff to reference when setting up auth
i used that recetnly
HoopoeOP
im at v4
not v5
ohh okay gotcha
HoopoeOP
i dont want to upgrade to a beta version rn though
i dont blame u
HoopoeOP
is it stable enough?
i guess we;ll find out Γ°ΕΈΛβ
i havent deployed yet im still developing my app
HoopoeOP
oh cool
it was just kinda hard to figure out role based auth cuz its kinda sparse