https://supertokens.com/ logo
#support-questions
Title
# support-questions
n

Noodles

11/23/2022, 9:24 AM
What would be the best way to verify sessions with Next.JS and a custom UI? (Node + JS SDK) - Currently I have a auth HOC that checks the session is valid, every authenticated page is under this HOC, but this means that on every navigation, the session must be verified again, sometimes this can make pages load a little slow. Is there a better way to do it?
r

rp

11/23/2022, 9:26 AM
hey @Noodles
you can use wrapper even with your custom UI
n

Noodles

11/23/2022, 9:27 AM
Oh really? I thought that was just for supertokens-auth-react?
r

rp

11/23/2022, 9:27 AM
the SessionAuth wrapper should not be slow though. Are you seeing a call to the email verification GET API on each page navigation?
if you are using auth-react on the frontend and have your custom UI using that, then you can use SessionAuth
if you are not using auth-react at all on the frontend and are using web-js on the frontend, then you will have to use the Session.doesSessionExist function on the frontend - like the docs say
n

Noodles

11/23/2022, 9:28 AM
Got it, I'll take a look. Thanks!