Failed to authenticate No auth provider found matching the given token, check your server auth con
I followed the docs and setup auth with convex and clerk in my nextjs project, but I keep getting the same error.
Here below you can see some code snippets and the console logs.
The jwt token is showing up in the console but the auth error is still there.
On the backend I did set the auth.config.ts and also copied the jwt template from clerk. But I am still stuck.
Does anyone have a clue of what might be wrong?




19 Replies
Hey @IsmailK, follow https://docs.convex.dev/auth/debug
Debugging Authentication | Convex Developer Hub
You have followed one of our authentication guides but something is not working.
Looking at your code, the problem is likely because you have ConvexReactClient
client
in two different modules
You basically don't need the inner ConvexClientProvider
I did go through the docs and read that part, but didnt realize the duplicate ConvexReactClient caused the issues. I will try your solution.... in the morning.
I removed the inner ConvexReactClient, but the issue is still there. So I checked the network tab in the browser. And saw the following:

It seems it connects and then disconnects
Can you paste your updated AuthenticationProvider function body
sure one second
Here it is

I have also set the JWT issuer properly in the environement variables of convex. So I am not sure what could cause that error.
I think I know what is wrong. I pushed the convex to production with clerks dev env variables as well yesterday night. I will fix that first.
In the convex production the jwt issuer of clerk is the production jwt issuer , but in the authentication section the domain is the clerk dev env jwt issuer. That confuses me. How do I fix that?
Authentication is depicting how to set up for dev I believe. Dev for dev, production for production. Let me know if I’m not understanding your question.
I just need to know how to correct the authentication variables in the prod en dev environement of convex
Right now the values in the authentication configuration of the convex prod are what should be in the convex dev. And in the convex dev there is no authentication configuration. Do I just delete the project and start over?
I set up a new project in convex and clerk. This time I did not push anything to production on convex or clerk and I still get the same error. Which makes no sense. Again there is no authentication configuration in convex dev dashboard.
I must be missing something here. Why can’t you update the configuration on the existing project? And the new project is going to have authentication errors if you don’t configure authentication. What am I missing?
I just couldnt find in the docs how to update the authentication configuration
I will close this, since I am switching to supabase.
Same here am also facing the same error
@IsmailK missed this one, if you still have any interest I'm happy to help you get auth figured out
@Devben I know you have a couple of threads open, if this is a distinct issue from the others let's open a separate support forum post for it, don't want to get yours and the OP's issues confused
I'm very sorry already open one but I need it asap and I couldn't wait that's why i message here but still trying the example one of the convex team gave to me... If I have any other problem about the clerk auth I'll message on the other thread thanks
No problem!
Now I think I need your help am messaging on the other threads thanks
The auth config is specified in
convex/auth.config.js
in the code you deploy. If those use environment variables, like process.env.CLERK_ISSUER_URL
then you set the environment variables in the appropriate prod/dev settings. e.g. https://dashboard.convex.dev/deployment/settings/environment-variables?var=CLERK_ISSUER_URL
- there's a toggle at the top for dev vs. prod. For @IsmailK or @Devben or other future readers, it's part of step 4 here and here is a debugging guide. Hope that helpsConvex Clerk | Convex Developer Hub
Clerk is an authentication platform providing login via
Debugging Authentication | Convex Developer Hub
You have followed one of our authentication guides but something is not working.