How to get user id client-side
# support-questions
l
How to get user id client-side
r
Hey @lavenderlav
l
Hi there
r
Which SDK are you using on the frontend?
l
I suppose its the react one
l
What about
useSessionContext
r
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
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
Which recipe are you using for login?
l
password email^
r
So there is a component in the emailpassword recipe called EmailPasswordAuth. Use that
l
Alright thanks!!
- pages/app/channels/me
- clients/supertokensPublic
r
Well.. make sure that that component is not being called during server side rendering
R u using NextJS?
l
yup^
r
See this
l
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
Well… make sure you have set correct values for apiDomain, websiteDomain, and if u r using axios, then add interceptors etc..
l
ahh maybe because I have not initialized it?
r
Go through this list and see why it may not be working
l
is
supertokens-auth-react/recipe/session
a frontend or backend
r
Frontend
That whole sdk is for frontend
l
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
Please see our docs for this. It’s fairly easy to solve TS issues by yourself 🙂
l
alright^
wait it somehow fixed itsself 😟
3 Views