#auth config

3 messages · Page 1 of 1 (latest)

onyx helm
#

For my auth.config.js file what should it look like for integrating with clerk ( im in nextjs )

quaint nightBOT
#

Hi @onyx helm. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:

#

To integrate Convex with Clerk in a Next.js app, your auth.config.ts (or auth.config.js if you're using JavaScript) file should look like this:

import { AuthConfig } from "convex/server";

export default {
  providers: [
    {
      // Use your Clerk Issuer URL from your "convex" JWT template,
      // or reference it via an environment variable.
      // Make sure to set CLERK_JWT_ISSUER_DOMAIN in your Convex dashboard.
      domain: process.env.CLERK_JWT_ISSUER_DOMAIN!,
      applicationID: "convex",
    },
  ]
} satisfies AuthConfig;

Key points:

  • The domain should be set to your Clerk Frontend API URL (the issuer domain from your Clerk JWT template). It's best practice to use an environment variable like CLERK_JWT_ISSUER_DOMAIN for this.
  • The applicationID should be "convex".
  • Make sure to set the CLERK_JWT_ISSUER_DOMAIN environment variable in your Convex dashboard for both development and production environments.
  • You do not need to include a type field in the provider object—doing so may cause errors as discussed in support threads.

For more details and step-by-step setup, see the official Convex & Clerk Next.js guide: Convex & Clerk Next.js Integration.

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: