Configure OAuth authentication providers for Clerk (Google, GitHub, Discord, Apple, Microsoft, Facebook, LinkedIn, Twitter, and 11+ more). Use when setting up social login, configuring OAuth providers, implementing authentication flows, generating redirect URLs, testing OAuth connections, or when user mentions Clerk OAuth, social authentication, provider setup, or multi-provider auth.
Limited to specific tools
Additional assets for this skill
This skill is limited to using the following tools:
examples/enterprise-sso-setup.mdexamples/gaming-platform-oauth.mdexamples/multi-provider-setup.mdexamples/oauth-button-component.tsxscripts/generate-redirect-urls.shscripts/setup-provider.shscripts/test-oauth-flow.shtemplates/apple/clerk-config.tstemplates/discord/clerk-config.tstemplates/facebook/clerk-config.tstemplates/github/clerk-config.tstemplates/google/clerk-config.tstemplates/linkedin/clerk-config.tstemplates/microsoft/clerk-config.tstemplates/oauth-shared/AuthButtons.tsxtemplates/oauth-shared/clerk-dashboard-config.tstemplates/twitter/clerk-config.tsThis skill provides complete OAuth provider configuration for Clerk-powered applications. It covers all 19+ supported OAuth providers with templates, setup scripts, testing utilities, and integration patterns for Next.js, React, and other frameworks.
Tier 1 (Most Common):
Tier 2 (Social & Professional):
Tier 3 (Specialized):
Configure any OAuth provider with automated setup:
# Set up single provider
bash scripts/setup-provider.sh google
# Set up multiple providers
bash scripts/setup-provider.sh google github discord
# Interactive setup with prompts
bash scripts/setup-provider.sh --interactive
What the Script Does:
Output:
Generate callback URLs for all environments:
# Generate for specific provider
bash scripts/generate-redirect-urls.sh google
# Generate for all configured providers
bash scripts/generate-redirect-urls.sh --all
# Export to environment file
bash scripts/generate-redirect-urls.sh google --export > .env.oauth
Redirect URL Patterns:
Development:
http://localhost:3000/api/auth/callback/google
Production:
https://yourdomain.com/api/auth/callback/google
Clerk Default:
https://your-clerk-domain.clerk.accounts.dev/v1/oauth_callback
Validate OAuth configuration end-to-end:
# Test single provider
bash scripts/test-oauth-flow.sh google
# Test all providers
bash scripts/test-oauth-flow.sh --all
# Generate test report
bash scripts/test-oauth-flow.sh google --report
Tests Performed:
Access pre-configured templates for each provider:
Google OAuth:
// templates/google/clerk-config.ts
import { google } from '@clerk/clerk-sdk-node';
export const googleConfig = {
clientId: process.env.GOOGLE_CLIENT_ID,
clientSecret: process.env.GOOGLE_CLIENT_SECRET,
redirectUri: process.env.GOOGLE_REDIRECT_URI,
scopes: ['profile', 'email'],
// Google-specific options
accessType: 'offline',
prompt: 'consent'
};
GitHub OAuth:
// templates/github/clerk-config.ts
export const githubConfig = {
clientId: process.env.GITHUB_CLIENT_ID,
clientSecret: process.env.GITHUB_CLIENT_SECRET,
redirectUri: process.env.GITHUB_REDIRECT_URI,
scopes: ['read:user', 'user:email'],
// GitHub-specific options
allowSignup: true
};
Discord OAuth:
// templates/discord/clerk-config.ts
export const discordConfig = {
clientId: process.env.DISCORD_CLIENT_ID,
clientSecret: process.env.DISCORD_CLIENT_SECRET,
redirectUri: process.env.DISCORD_REDIRECT_URI,
scopes: ['identify', 'email'],
// Discord-specific options
permissions: '0'
};
React/Next.js Components:
// templates/oauth-shared/AuthButtons.tsx
import { SignIn } from '@clerk/nextjs';
export function AuthButtons() {
return (
<div className="auth-providers">
<SignIn.Root>
<SignIn.Step name="start">
<div className="provider-buttons">
<SignIn.Strategy name="oauth_google">
<button>Continue with Google</button>
</SignIn.Strategy>
<SignIn.Strategy name="oauth_github">
<button>Continue with GitHub</button>
</SignIn.Strategy>
<SignIn.Strategy name="oauth_discord">
<button>Continue with Discord</button>
</SignIn.Strategy>
</div>
</SignIn.Step>
</SignIn.Root>
</div>
);
}
Clerk Dashboard Configuration:
// templates/oauth-shared/clerk-dashboard-config.ts
export const oauthProviders = [
{
provider: 'google',
enabled: true,
clientId: 'GOOGLE_CLIENT_ID',
clientSecret: 'GOOGLE_CLIENT_SECRET',
scopes: ['profile', 'email']
},
{
provider: 'github',
enabled: true,
clientId: 'GITHUB_CLIENT_ID',
clientSecret: 'GITHUB_CLIENT_SECRET',
scopes: ['read:user', 'user:email']
},
{
provider: 'discord',
enabled: true,
clientId: 'DISCORD_CLIENT_ID',
clientSecret: 'DISCORD_CLIENT_SECRET',
scopes: ['identify', 'email']
}
];
# 1. Set up Google OAuth
bash scripts/setup-provider.sh google
# Follow prompts:
# - Create OAuth app in Google Cloud Console
# - Configure authorized redirect URIs
# - Copy Client ID and Client Secret
# - Add to Clerk Dashboard
# 2. Generate redirect URLs
bash scripts/generate-redirect-urls.sh google --export > .env.google
# 3. Test OAuth flow
bash scripts/test-oauth-flow.sh google
# 4. Add to React app
cp templates/google/clerk-config.ts ./lib/auth/google.ts
cp templates/oauth-shared/AuthButtons.tsx ./components/auth/
Result: Fully configured Google OAuth with sign-in button and tested flow
# Set up all providers
for provider in google github discord; do
bash scripts/setup-provider.sh $provider
done
# Generate all redirect URLs
bash scripts/generate-redirect-urls.sh --all --export > .env.oauth
# Test all providers
bash scripts/test-oauth-flow.sh --all --report
# Deploy multi-provider UI
cp templates/oauth-shared/AuthButtons.tsx ./components/auth/
Result: Users can sign in with Google, GitHub, or Discord
# Set up enterprise providers
bash scripts/setup-provider.sh microsoft linkedin
# Configure enterprise-specific scopes
# Edit templates/microsoft/clerk-config.ts to add Azure AD scopes
# Edit templates/linkedin/clerk-config.ts for LinkedIn API v2
# Test enterprise flows
bash scripts/test-oauth-flow.sh microsoft --report
bash scripts/test-oauth-flow.sh linkedin --report
Result: Enterprise authentication with Microsoft 365 and LinkedIn integration
# Set up gaming providers
bash scripts/setup-provider.sh discord twitch
# Configure gaming-specific permissions
# Discord: guild membership, voice state
# Twitch: user:read:email, channel subscriptions
# Test gaming provider flows
bash scripts/test-oauth-flow.sh discord twitch
Result: Gaming platform authentication with Discord and Twitch integration
Environment Variables:
CLERK_PUBLISHABLE_KEY - Clerk public keyCLERK_SECRET_KEY - Clerk secret keyGOOGLE_CLIENT_ID, GOOGLE_CLIENT_SECRET)Dependencies:
@clerk/clerk-sdk-node - Clerk Node.js SDK@clerk/nextjs - Clerk Next.js integration (for Next.js apps)@clerk/clerk-react - Clerk React components (for React apps)Clerk Project Setup:
For Each OAuth Provider:
CRITICAL: When generating any configuration files or code:
NEVER hardcode actual API keys or secrets
NEVER include real credentials in examples
NEVER commit sensitive values to git
ALWAYS use placeholders: your_service_key_here
ALWAYS create .env.example with placeholders only
ALWAYS add .env* to .gitignore (except .env.example)
ALWAYS read from environment variables in code
ALWAYS document where to obtain keys
Placeholder format: {provider}_{env}_your_key_here
Example:
# .env.example (safe to commit)
GOOGLE_CLIENT_ID=google_dev_your_client_id_here
GOOGLE_CLIENT_SECRET=google_dev_your_client_secret_here
# .env (NEVER commit)
GOOGLE_CLIENT_ID=actual_client_id_from_google_cloud
GOOGLE_CLIENT_SECRET=actual_secret_from_google_cloud
Documentation: templates/google/SETUP.md
Required Scopes:
profile - User profile informationemail - Email addressopenid - OpenID ConnectDocumentation: templates/github/SETUP.md
Required Scopes:
read:user - Read user profileuser:email - Access user email addressesDocumentation: templates/discord/SETUP.md
Required Scopes:
identify - User identityemail - Email addressguilds - Server list (optional)Documentation: templates/microsoft/SETUP.md
Required Scopes:
openid - OpenID Connectprofile - User profileemail - Email addressUser.Read - Microsoft Graph APIDocumentation: templates/apple/SETUP.md
Required Scopes:
name - User nameemail - Email addressMulti-Provider Strategy:
Redirect URL Management:
Scope Configuration:
Error Handling:
Testing:
Security:
Redirect URI Mismatch:
Invalid Client Credentials:
Scope Authorization Failed:
Token Exchange Error:
User Profile Retrieval Failed:
Plugin: clerk Version: 1.0.0 Category: Authentication Skill Type: Configuration Providers Supported: 19+