Authentication
BolkAuth OAuth support starts a provider redirect from your app, validates the returned state, links or creates a user, and then issues a BolkAuth session cookie.
Configuration
Routes
| Route | Description |
|---|---|
GET /api/auth/oauth/:provider | Starts the provider authorization flow. |
GET /api/auth/oauth/:provider/callback | Handles the OAuth callback. |
For GitHub, register this callback URL:
For production, replace the origin with your deployed app URL.
React Hook
Flow
Troubleshooting
OAuth failures are usually caused by one of these:
| Issue | Fix |
|---|---|
| Callback mismatch | Register /api/auth/oauth/:provider/callback exactly in the provider dashboard. |
| Missing credentials | Set GITHUB_CLIENT_ID, GITHUB_CLIENT_SECRET, or the equivalent provider variables. |
| State mismatch | Make sure cookies are not blocked and the callback returns to the same origin. |