Hi, I am try to use useSessionContext to get user ...
# support-questions
p
Hi, I am try to use useSessionContext to get user info in frontend. After I wrap _app with the error shown. What should I do ?
r
hey @PPaii
Can you show me some code? Also, are you using NextJS?
p
yes, i am using Next.js
You need to wrap the EmailPasswordAuth component in NextJS'
dynamic
HOC
p
So do i need to wrap in _app.tsx?
r
Yea. But i would not recommend that you wrap your whole app in _app.tsx
Only wrap the pages that you want the user to access when they are logged in
cause then none of your app pages will be server side rendered.
p
It is possible for me to get user info without warpping ?
r
Yes. You can use the session recipe functions directly like: -
await Session.doesSessionExist()
-
await Session.getAccessTokenPayloadSecurely()
-
await Session.getUserId()
p
Thanks. So if I want to use useSessionContext, I need to make sure the page it not SSR. If i want to get user info in SSR page, I need to use the functions
r
Those functions are also for client side only