GitHub OAuth Apps allow one callback URL each, so create one app for local development and one for production.
1. Create the OAuth App
- Open GitHub → Settings → Developer settings → OAuth Apps and click New OAuth App.
- Fill in:
- Application name: your product name
- Homepage URL:
http://localhost:3000(or your domain) - Authorization callback URL:
http://localhost:3000/api/auth/callback/github(orhttps://your-domain.com/api/auth/callback/github)
- Click Register application, then Generate a new client secret.
- Copy the client ID and secret.
2. Configure the app
NEXT_PUBLIC_AUTH_GITHUB=true
AUTH_GITHUB_CLIENT_ID="Ov23li..."
AUTH_GITHUB_CLIENT_SECRET="..."
Set EXPO_PUBLIC_AUTH_GITHUB and VITE_AUTH_GITHUB too if you use the native apps.
Notes
- Users with a private primary email still sign in; Better Auth requests the
user:emailscope to read it. - If an organization owns the app, members may need to approve it under the organization's third-party access settings.
