GitHub OAuth

Learn how to configure GitHub OAuth.

Set Up GitHub OAuth

Developer Settings

Go to GitHub and login.

Click your profile icon → Settings.

For an organization-owned application:

Click your profile icon → Your organizationsSettings (of the organization).

Next, click Developer settings (at the bottom of the left sidebar).

Create a new OAuth App

Select OAuth Apps and click New OAuth App.

Fill in the application name and homepage URL.

  • Application name: Your application name
  • Homepage URL: http://localhost:3000 (or your production URL)

Add authorization callback URL:

http://localhost:3000/api/auth/callback/github

For production:

https://your-domain.com/api/auth/callback/github

Click Register application.

Update the environment variables

Copy the Client ID and paste it beside GITHUB_CLIENT_ID in the .env file.

Create a new client secret, copy it and paste it beside GITHUB_CLIENT_SECRET in the .env file.

.env
GITHUB_CLIENT_ID=your-github-client-id
GITHUB_CLIENT_SECRET=your-github-client-secret

Test the integration

Restart the server and go to http://localhost:3000/signin.

Click Sign in with GitHub.