Inconsistent auth status between convex and clerk.
Trying to understand how to solve this issue.
Auth using clerk.
Clerk setup with JWT templates for convex.
auth.config.ts setup with correct values, and is consistent with auth settings within Convex dashboard.
Clerk logs in fine (and same with create new), and reports isAuthenticated = true, however using Convex it always returns isAuthenticated = false.
22 Replies
I should note also that the isLoading changes to true (useConvexAuth) and then back to false.
I do get the following message in console:
Failed to authenticate: "No auth provider found matching the given token", check your server auth config
Hey @madjae , did you follow the Convex setup guide? https://docs.convex.dev/auth/clerk#get-started
Convex Clerk | Convex Developer Hub
Clerk is an authentication platform providing login via
yes indeed
Seems like I'm 99% there.
Just bizarre that clerk is saying authenticated but convex is not.
You need to use
auth.config.js
, not auth.config.ts
If you are using .js, then something is wrong with the values in itexport default {
providers: [
{
domain: "https://xxx-xxx-99.accounts.dev",
applicationID: "convex",
},
],
};
obviously xxx is an obstructionAnd the file name ends in "js" ?
correct.
auth.config.js
Have you deployed?
npx convex dev
is running? (assuming this is a dev deployment setup)correct - dev environment.
npx convex dev
is running and showing no errors.What do your dashboard logs show?


Console logs show this during login:

Your frontend is definitely talking to the backend you're configuring? If you change
documents:getById
your web app reflects the changes?I'm not seeing changes reflected. It seems websocket is failing auth thus the error above
Well any functions not relying on
ctx.auth.getUserIdentity()
should continue to workCan you also check this settings page on your Convex dashboard

Yep it has the same values as per the
auth.config.js
fileNice. On your website you can double check which backend your app is talking to in the network tab:

The
wss://
address should match the URL of your convex dashboard (the deployment name is shown in both)
If all of that lines up, then I would double check your publishableKey passed to ConvexProviderWithClerk
is the right one, from the same Clerk instance you got your issuer URL in your auth.config.jsAh I think you found the issue. WS is pointing to an older domain name.
Must be cached somewhere?!?
Check your CONVEX_URL that is passed to
ConvexReactClient
Usually it comes from your .env.local file (depends on your client setup)
If the file is wrong you can copy the right URL from the Settings page