OAuth Integration
Enable Single Sign-On (SSO) with GitHub or Google for your Bloqd dashboard.
Supported Providers
| Provider | Status |
|---|---|
| GitHub | Supported |
| Supported | |
| Custom OIDC | Coming soon |
GitHub OAuth
1. Create GitHub OAuth App
- Go to GitHub → Settings → Developer settings → OAuth Apps
- Click New OAuth App
- Fill in the details:
- Application name: Bloqd
- Homepage URL:
https://bloqd.example.com - Authorization callback URL:
https://bloqd.example.com/api/v1/auth/github/callback
- Click Register application
- Copy the Client ID
- Generate and copy a Client Secret
2. Configure in Bloqd
Via environment variables:
GITHUB_CLIENT_ID=your_client_id
GITHUB_CLIENT_SECRET=your_client_secret
GITHUB_CALLBACK_URL=https://bloqd.example.com/api/v1/auth/github/callback
3. Allowed Users
By default, any GitHub user can attempt login. To restrict:
# Only allow specific users
GITHUB_ALLOWED_USERS=user1,user2,user3
# Or allow an entire organization
GITHUB_ALLOWED_ORG=your-organization
Google OAuth
1. Create Google OAuth Credentials
- 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
- Fill in:
- Name: Bloqd
- Authorized redirect URIs:
https://bloqd.example.com/api/v1/auth/google/callback
- Click Create
- Copy Client ID and Client Secret
2. Configure in Bloqd
Via environment variables:
GOOGLE_CLIENT_ID=your_client_id
GOOGLE_CLIENT_SECRET=your_client_secret
GOOGLE_CALLBACK_URL=https://bloqd.example.com/api/v1/auth/google/callback
3. Allowed Domains
Restrict to specific email domains:
# Only allow your company domain
GOOGLE_ALLOWED_DOMAINS=example.com,company.com
Login Flow
┌────────┐ ┌───────────┐ ┌──────────────┐
│ User │────►│ Bloqd │────►│ Provider │
│ │ │ (Login) │ │(GitHub/Google)│
└────────┘ └───────────┘ └──────┬───────┘
│
┌────────────────────────────────────┘
│ OAuth callback with token
▼
┌───────────┐ ┌────────────┐
│ Bloqd │────►│ Dashboard │
│ (Verify) │ │ (Logged in)│
└───────────┘ └────────────┘
- User clicks "Login with GitHub/Google"
- Redirected to provider for authentication
- User authorizes Bloqd
- Provider redirects back with auth code
- Bloqd exchanges code for user info
- Bloqd creates session and redirects to dashboard
User Management
First Login
When a user first logs in via OAuth:
- Account is created automatically
- Default role is assigned (configurable)
- Admin can modify role later
Role Assignment
Configure default role for OAuth users:
OAUTH_DEFAULT_ROLE=Viewer
Options:
Viewer- Read-only accessOperator- Can manage serversAdmin- Full access
Linking Existing Account
If a user has an existing local account:
- Log in with local credentials
- Go to Profile → Linked Accounts
- Click Link GitHub or Link Google
- Authorize the connection
Security Considerations
HTTPS Required
OAuth requires HTTPS for callback URLs. Ensure your Bloqd instance has valid SSL.
Token Storage
OAuth tokens are:
- Stored encrypted in database
- Not accessible via API
- Automatically refreshed when needed
Session Management
OAuth sessions:
- Expire after configured time
- Can be revoked by admin
- Support "Remember me" option
Disabling Local Login
To require OAuth for all users:
DISABLE_LOCAL_LOGIN=true
warning
Ensure at least one admin can log in via OAuth before disabling local login.
Troubleshooting
Callback URL Mismatch
Error: redirect_uri_mismatch
- Verify callback URL in provider settings
- Ensure it matches exactly (including https://)
- Check for trailing slashes
User Not Allowed
Error: User not in allowed list
- Add user to
GITHUB_ALLOWED_USERSorGOOGLE_ALLOWED_DOMAINS - Or remove restrictions to allow all users
Invalid Client
Error: invalid_client
- Verify Client ID is correct
- Verify Client Secret is correct
- Check credentials haven't been revoked
SSL Certificate Error
Error: SSL certificate problem
- Ensure valid SSL certificate
- Check certificate chain is complete
- Verify callback URL uses https://
Best Practices
- Use organization restrictions - Don't allow arbitrary users
- Set appropriate default role - Start with Viewer
- Require MFA - Enable MFA for OAuth accounts too
- Audit logins - Review login history regularly
- Keep secrets secure - Don't commit to version control