Before you can useDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/MomenSherif/react-oauth/llms.txt
Use this file to discover all available pages before exploring further.
@react-oauth/github, you need a GitHub OAuth App to obtain a Client ID. This guide walks you through registration and configuration.
Go to GitHub Developer Settings
Sign in to GitHub, then navigate to:Settings → Developer settings → OAuth AppsOr go directly to github.com/settings/developers and click the OAuth Apps tab.
Create a new OAuth App
Click New OAuth App (or Register a new application if this is your first app).
Fill in the application details
Complete the registration form:
| Field | Description | Example |
|---|---|---|
| Application name | The name users see on the GitHub authorization screen | My App |
| Homepage URL | Your app’s public-facing URL | https://myapp.com |
| Application description | Optional description shown to users during authorization | Sign in to My App |
| Authorization callback URL | The URL GitHub redirects to after authorization | http://localhost:3000/callback |
The Authorization callback URL must exactly match the
redirectUri you pass to useGitHubLogin. GitHub rejects requests whose redirect URI does not match this value.Register the application
Click Register application. GitHub creates your OAuth App and takes you to its settings page.
Local development setup
During development, set your Authorization callback URL to your local dev server’s callback route, for example:redirectUri in the hook:
Multiple environments
GitHub OAuth Apps support only a single Authorization callback URL. To work across multiple environments (development, staging, production), create a separate OAuth App for each environment, each with its own callback URL and Client ID.| Environment | Callback URL | Client ID |
|---|---|---|
| Development | http://localhost:3000/callback | from dev app |
| Staging | https://staging.myapp.com/callback | from staging app |
| Production | https://myapp.com/callback | from production app |
Important notes
- The callback URL must match exactly. Including or omitting a trailing slash, changing
httptohttps, or using a different port will cause GitHub to reject the request. - The Client Secret stays on the server. Only the Client ID is used in the frontend. The Client Secret is required only for the server-side code exchange.
- You can update the callback URL in the OAuth App settings at any time, but the change takes effect immediately — update your app’s
redirectUriat the same time to avoid broken logins.

