#Better Auth
5 messages · Page 1 of 1 (latest)
The error message:
Better Auth
2025-10-27T18:25:56.982Z ERROR [Better Auth]: Provider not found. Make sure to add the provider in your auth config {
provider: 'github'
}
means that the "github" provider is not configured in your Better Auth setup. To resolve this, you need to add the GitHub provider to your authentication configuration.
For Better Auth with Convex, your convex/auth.config.ts (or similar) should include the GitHub provider. Here’s how you can do it for a typical setup:
export default {
providers: [
{
domain: process.env.CONVEX_SITE_URL,
applicationID: "convex",
// Add other provider-specific config here if needed
},
// Add GitHub provider here if using OAuth
],
};
However, for OAuth providers like GitHub, you typically need to use the Convex Auth integration with Auth.js providers. For example, your convex/auth.ts should look like:
import GitHub from "@auth/core/providers/github";
import { convexAuth } from "@convex-dev/auth/server";
export const { auth, signIn, signOut, store, isAuthenticated } = convexAuth({
providers: [GitHub],
});
You also need to set the required environment variables for GitHub OAuth:
npx convex env set AUTH_GITHUB_ID <yourgithubclientid>
npx convex env set AUTH_GITHUB_SECRET <yourgithubsecret>
And make sure your callback URL is set correctly as described in the documentation (e.g., <https://your-deployment.convex.site/api/auth/callback/github>) Instructions for GitHub OAuth.
Summary:
Add the GitHub provider to your auth config and ensure all required environment variables are set. If you’re using Better Auth, make sure your provider list includes GitHub, or if you’re using Convex Auth with Auth.js, follow the OAuth provider setup as shown above. If you miss this step, you’ll get the "Provider not found" error when trying to use GitHub authentication.
If you need more specific guidance for your framework (Next.js, React, etc.), let me know!
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
@low walrus Kapa.ai is still learning and improving, please let me know how I did by reacting below.
auth.config.ts
export default { providers: [ { domain: process.env.CONVEX_SITE_URL, applicationID: "convex", }, ], };
auth.ts
`
import { createClient, type GenericCtx } from "@convex-dev/better-auth";
import { convex } from "@convex-dev/better-auth/plugins";
import { expo } from "@better-auth/expo";
import { components } from "./_generated/api";
import { DataModel } from "./_generated/dataModel";
import { query } from "./_generated/server";
import { betterAuth } from "better-auth";
import { v } from "convex/values";
const siteUrl = process.env.SITE_URL!;
const nativeAppUrl = process.env.NATIVE_APP_URL || "mybettertapp://";
export const authComponent = createClient<DataModel>(components.betterAuth);
function createAuth(
ctx: GenericCtx<DataModel>,
{ optionsOnly }: { optionsOnly?: boolean } = { optionsOnly: false },
) {
return betterAuth({
logger: {
disabled: optionsOnly,
},
baseURL: siteUrl,
trustedOrigins: [siteUrl, nativeAppUrl],
database: authComponent.adapter(ctx),
emailAndPassword: {
enabled: true,
requireEmailVerification: false,
},
plugins: [expo(), convex()],
});
}
export { createAuth };
export const getCurrentUser = query({
args: {},
returns: v.any(),
handler: async function (ctx, args) {
return authComponent.getAuthUser(ctx);
},
});
`