Fei Xiang
Fei Xiang4mo ago

Why I can't get current logged in user information

When I logged in using convex auth, auth and user tables updated, but can't get current authenticated user like this way const identity = await ctx.auth.getUserIdentity(); Also got this error
No description
4 Replies
ballingt
ballingt4mo ago
What does your JWT token look like, and what does your convex/auth.config.ts look like?
Fei Xiang
Fei XiangOP4mo ago
auth.config.ts: const config = { providers: [ { domain: process.env.NEXT_PUBLIC_CONVEX_CLOUD_URL, applicationID: 'thirdparties', }, ], }; export default config;
No description
sshader
sshader4mo ago
When using Convex auth, the URL should end in .convex.site, not .convex.cloud. The usual configuration is
providers: [{
domain: process.env.CONVEX_SITE_URL,
applicationID: "convex"
}]
providers: [{
domain: process.env.CONVEX_SITE_URL,
applicationID: "convex"
}]
(https://labs.convex.dev/auth/setup/manual#configure-authconfigts) Importantly, it needs to match the iss and aud field in the token sent to the backend in the Authenticate message (https://docs.convex.dev/auth/debug#step-3-check-that-backend-configuration-matches-frontend-configuration)
Manual Setup - Convex Auth
Authentication library for your Convex backend
Debugging Authentication | Convex Developer Hub
You have followed one of our authentication guides but something is not working.
Fei Xiang
Fei XiangOP4mo ago
@sshader Thank you for your reply It's very helpful

Did you find this page helpful?