Clerk with multiple domains
How could I set up auth in Convex + Clerk for apps that are in multiple web domains?
for example:
app 1 = bz.com
app 2 = fx.com
That means that env variable
CLERK_JWT_ISSUER_DOMAIN
will not work for both, right?
Would I have to remove the ConvexProviderWithClerk
from the Provider in react?
I opened a git issue in the monorepo template.
https://github.com/get-convex/turbo-expo-nextjs-clerk-convex-monorepo/issues/2GitHub
Multi-domain with Clerk · Issue #2 · get-convex/turbo-expo-nextjs-c...
I have a mono-repo where I have two apps hosted in different domain each. for example: app 1 = bz.com app 2 = fx.com That means that CLERK_JWT_ISSUER_DOMAIN will not work for both, right? Would I h...
13 Replies
So two apps sharing the same
/convex
directory for backend? Or a single app deployed to multiple domainstwo different apps in their own domain each, sharing the same convex directory and database
I am thinking that maybe in auth.config.js i can set up a provider for each domain
I haven't thought all the way through your use case but is it possible you can address this on the Clerk side? They support multiple domains for a single instance it seems: https://clerk.com/docs/advanced-usage/satellite-domains#adding-satellite-domains
Adding satellite domains | Clerk
Learn how to share sessions across different domains by adding satellite domains to your application.
I may be missing something super obvious in suggesting this though lol
actually looks like that may be more for auth flows that involve multiple domains
I think this is more a convex thing since I have to set it up in
convex/auth.config.js
this env var is set up within the convex dashboard
No I see that, I'm just wondering if Clerk can support multiple domains in practice while using the single issuer domain for an instance.
This would have to be true of satellite domains
Or do you have two separate Clerk projects for these two apps
i already have the separate Clerk projects working, but one app is in convex and the other in fauna
so i want to merge fauna data into convex
but keeping the client side apps separate since they are for different set of users
one is internal and the other is customers
so they have different auth workflows and permissions
and different branding
but would be more of a pain to have two separate convex databases talking to each other throuh HTTP
I'm just wondering if maintaining two clerk instances is also a pain that can maybe be avoided, guessing you have a users table that all users from both domains are going to
but I'll stop trying to XY problem solve and let someone from the Convex team chime in on your original question
I'm thinking about having two different user tables in the same convex db
to be extra safe
clerk instances are barely any maintenance.. i fetch the roles and permisions from the convex tables on every query or mutation
1. Use the same clerk instance. Then you have one domain in your auth.config.ts
2. Use 2 clerk instances. Then you can put both into the
providers
list. Your Convex backend will accept login from either instance. You will want to dedupe your users, probably based on their email (but this is totally up to you).perfect, thanks
makes sense
would the applicationID for both clerk instances will be "convex"?
example auth.config.ts