-
Notifications
You must be signed in to change notification settings - Fork 67
Description
Hi team,
I am trying to make the custom JWT auth work, but the auth state remains desperately unauthenticated, despite following strictly the doc steps. There is no error, nothing else, so I suspect a step is missing, but I can't find which one.
Minimal repro: https://github.com/antoineol/convex-jwt
git clone https://github.com/antoineol/convex-jwt.git
cd convex-jwt
bun install
bun dev
FYI, steps followed to build it:
- nextjs quickstart: https://docs.convex.dev/quickstart/nextjs
- Add a minimal JWT generation + JWKS URL & data URL with jose library
- custom JWT doc steps: https://docs.convex.dev/auth/advanced/custom-jwt
- Custom OIDC > Client-side integration steps to add the hooks
- A small piece of UI to show the JWT hook + the convex hook
PS: .env.local is versioned on purpose with RSA public/private key for the demo, so that all pieces are there to reproduce.
Thanks a lot for your help! 🙏
More context: I'm trying to add a nextjs + convex app next to our product existing app (Rails + devise + postgres) with live sync, to progressively migrate some pages while preserving a nice user navigation experience. It works great, except the auth.
Edit: I have the feeling the issue is related to the useProviderXAuth (or useAuthFromProviderX) that is required to have a specific behavior (not documented here), like prefetching the token without waiting for an explicit call to fetchAccessToken / getToken. But maybe not with an initial value either? I'm still trying to clarify it.