`ctx.auth.getUserIdentity()` returns `null` — missing aud claim despite using AuthKit & Convex
My setup:
- I use
AuthKitProvider and ConvexProviderWithAuthKit- I use
useAccessToken() from AuthKit and feed that token to Convex- In
convex/auth.config.ts, I set:- Redirect URI, env vars, etc. are set per docs
Problem: when I call
await ctx.auth.getUserIdentity() inside Convex functions, it returns null.The Convex docs say this happens if the ID token is missing an aud claim, and yes AuthKit’s access token doesn’t include aud.
What I’ve tried:
- Switching to
ConvexProviderWithAuth- Ensuring redirect URIs match
- Looking at starter kits (e.g. WorkOS + Convex example projects)
Question:
- Is there a configuration (in WorkOS or Convex) I’m missing so that AuthKit will issue an ID token with aud that Convex accepts?
- Has anyone else solved this so that
ctx.auth.getUserIdentity() works out of the box with AuthKit + Convex?- Am I supposed to use a different token than accessToken(), or is there a version mismatch / bug?
Any pointers or examples appreciated.
Workarounds:
Remove
applicationID: clientId on the second provider in the config.