OAuth Providers
Configure social login with OAuth providers.
Supported Providers
| Provider | Purpose |
|---|---|
| GitHub | Social login |
| Social login | |
| Discord | Social login |
GitHub OAuth
Create OAuth App
- Go to GitHub Developer Settings
- Click OAuth Apps > New OAuth App
- Fill in:
- Application name:
OpenCode Manager - Homepage URL:
http://localhost:5003 - Authorization callback URL:
http://localhost:5003/api/auth/callback/github - Click Register application
- Copy Client ID
- Generate and copy Client Secret
Configure
Callback URL
Adjust the callback URL for your environment:
| Environment | Callback URL |
|---|---|
| Local | http://localhost:5003/api/auth/callback/github |
| Production | https://yourdomain.com/api/auth/callback/github |
Google OAuth
Create OAuth Client
- Go to Google Cloud Console
- Create a new project or select existing
- Go to APIs & Services > Credentials
- Click Create Credentials > OAuth client ID
- Select Web application
- Configure:
- Name:
OpenCode Manager - Authorized redirect URIs:
http://localhost:5003/api/auth/callback/google - Click Create
- Copy Client ID and Client Secret
Configure
Consent Screen
You may need to configure the OAuth consent screen:
- Go to APIs & Services > OAuth consent screen
- Select External (or Internal for Workspace)
- Fill in required fields
- Add scopes:
email,profile - Save
Discord OAuth
Create Application
- Go to Discord Developer Portal
- Click New Application
- Name it
OpenCode Manager - Go to OAuth2 section
- Add redirect:
http://localhost:5003/api/auth/callback/discord - Copy Client ID and Client Secret
Configure
Using OAuth Login
Once configured:
- Go to the login page
- Click the provider button (GitHub, Google, Discord)
- Authorize in the popup
- You're logged in
First OAuth Login
On first OAuth login:
- Account is created automatically
- Email from provider is used
- No password is set (OAuth-only)
Linking Accounts
If you have an existing password account:
- Log in with password
- Go to Settings > Connected Accounts
- Click Connect for a provider
- Authorize the connection
Production Considerations
Update Callback URLs
Before deploying, update OAuth apps with production URLs:
https://yourdomain.com/api/auth/callback/github
https://yourdomain.com/api/auth/callback/google
https://yourdomain.com/api/auth/callback/discord
Verify Domains
Some providers require domain verification:
- Google requires verification for production
- Discord may require verification for many users
Secrets Management
- Never commit OAuth secrets to version control
- Use environment variables or secrets management
- Rotate secrets periodically
Troubleshooting
Redirect URI Mismatch
Error: "redirect_uri_mismatch" or similar
Solution: 1. Check callback URL in provider settings 2. Ensure exact match (including trailing slash) 3. Verify protocol (http vs https) 4. Check port number
Invalid Client
Error: "invalid_client" or "unauthorized_client"
Solution: 1. Verify Client ID is correct 2. Check Client Secret hasn't changed 3. Ensure OAuth app is not suspended
Access Denied
Error: "access_denied" or user cancels
Solution: 1. User may have denied permission 2. Check required scopes are configured 3. Verify consent screen is configured properly