#Convex Auth... Authenticated works but auth.getUserId(ctx) returns null

1 messages · Page 1 of 1 (latest)

rose plinth
#

Hi!
Quick question (hopefully) my auth cycle is working, i can use

...
      </Unauthenticated>
      <Authenticated>
...
      </Authenticated>```
And it's working as expected, but on the convex side i get null when i ask to the auth user.
any tips on where to start looking?
Thank you for your help!
plush anchor
rose plinth
#

it is consistently, i'll follow the guide and report back!

onyx crater
#

(usually it's because your function is not actually inside a component that's wrapped in Authenticated, and so it runs too soon)

plush anchor
#

Or b/c you don't have it listed as a provider in auth.config.ts - though then it wouldn't render in <Authenticated>

rose plinth
#

thanks i'll look into it now (busy day)
I have the ConvexClient (with auth) in my root layout and my auth.config.ts untouched

  providers: [
    {
      domain: process.env.CONVEX_SITE_URL,
      applicationID: "convex",
    },
  ],
};```
#

i'm sure i broke something, but i can't find out what :S

rose plinth
#

After long hours, It seems NextJs is not supported yet, that may be the cause?

onyx crater
#

Server-side authentication with Next.js is not supported yet. Are you using preloadQuery or fetchQuery?

rose plinth
#

yup, but i couldn't find how to get the token, the docs only describe clerk and auth0 😦