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

lavenderlav

04/29/2022, 6:44 AM
How to get user id client-side
r

rp

04/29/2022, 6:44 AM
Hey @lavenderlav
l

lavenderlav

04/29/2022, 6:44 AM
Hi there
r

rp

04/29/2022, 6:44 AM
Which SDK are you using on the frontend?
l

lavenderlav

04/29/2022, 6:45 AM
I suppose its the react one
l

lavenderlav

04/29/2022, 6:46 AM
What about
useSessionContext
r

rp

04/29/2022, 6:47 AM
Yea. That would work too
But for that, you need to wrap the component in the auth wrapper for the recipe you are using
l

lavenderlav

04/29/2022, 6:48 AM
Ahhh
no wonder it returns false
yup it does work now, thank you so much!^^
Which do I have to wrap it in again?
r

rp

04/29/2022, 6:59 AM
Which recipe are you using for login?
l

lavenderlav

04/29/2022, 7:01 AM
password email^
r

rp

04/29/2022, 7:02 AM
So there is a component in the emailpassword recipe called EmailPasswordAuth. Use that
l

lavenderlav

04/29/2022, 7:02 AM
Alright thanks!!
- pages/app/channels/me
- clients/supertokensPublic
r

rp

04/29/2022, 7:17 AM
Well.. make sure that that component is not being called during server side rendering
R u using NextJS?
l

lavenderlav

04/29/2022, 7:20 AM
yup^
r

rp

04/29/2022, 7:22 AM
See this
l

lavenderlav

04/29/2022, 7:22 AM
ahh now it works
but doesSessionExists still returns false even though the user is signed in
heres the code I used
Copy code
ts
    let a = useSessionContext();
    useEffect(() => {
        console.log(a)
    }, [a])
r

rp

04/29/2022, 7:23 AM
Well… make sure you have set correct values for apiDomain, websiteDomain, and if u r using axios, then add interceptors etc..
l

lavenderlav

04/29/2022, 7:24 AM
ahh maybe because I have not initialized it?
r

rp

04/29/2022, 7:24 AM
Go through this list and see why it may not be working
l

lavenderlav

04/29/2022, 7:26 AM
is
supertokens-auth-react/recipe/session
a frontend or backend
r

rp

04/29/2022, 7:26 AM
Frontend
That whole sdk is for frontend
l

lavenderlav

04/29/2022, 7:26 AM
Copy code
ts
Type '{ appInfo: { appName: string; apiDomain: string; websiteDomain: string; apiBasePath: string; websiteBasePath: string; }; recipeList: CreateRecipeFunction<unknown, unknown, unknown, any>[]; }' has no properties in common with type 'InputType'.
r

rp

04/29/2022, 7:27 AM
Please see our docs for this. It’s fairly easy to solve TS issues by yourself 🙂
l

lavenderlav

04/29/2022, 7:27 AM
alright^
wait it somehow fixed itsself 😟