Get NextJet
AuthenticationGithub OAuth

Github OAuth

Learn how to configure Github OAuth.

Register a Github OAuth App

Login to Github

Go to Github and login.

Click on your profile icon in the top right corner and select Settings.

For an app owned by an organization:

  • Click Your organizations.
  • To the right of the organization, click Settings.

Developer settings

In the left sidebar, click on Developer settings at the bottom.

Create a new Github App

Click on Github Apps in the left sidebar.

Click on New Github App.

Fill in the App information

Type your app name and description.

Fill in the production Homepage URL.

https://app.your-url.com

Note that I am using the app subdomain in the production URL.

Make sure to include the correct production URL of your application.

If you don't have a production URL yet, you can use http://localhost:3000 for now.

Fill in the User authorization callback URL

Add the User authorization callback URL.

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

Additionally, you can add the production URL as well like so:

https://app.your-url.com/api/auth/callback/github

Keep the default values for the rest of the fields.

Disable Webhooks

Uncheck the Active checkbox below the Webhook section.

Permissions

Click on the Account permissions accordion and select the read-only permission for Email addresses.

Leave everything else as is and click on Create Github App.

Generate a private key

Scroll down to the Private keys section and click Generate a private key.

You won't actually need this key for the OAuth flow.

Copy the Client ID and Client Secret

Scroll up to the top of the page and copy the Client ID and paste it beside GITHUB_CLIENT_ID in the .env file.

Below the Client secrets section click on Generate a new client secret button.

Copy the client secret and paste it beside GITHUB_CLIENT_SECRET in the .env file.

Restart the server

Congratulations! You can now use Github OAuth in your application.

Navigate to http://localhost:3000/signin and click on "Sign in with Github" to test the authentication.

Make sure to restart the server after adding the client ID and client secret in the .env.

It may take a few minutes for the Github OAuth to work after creating the Github OAuth app.

After a successful login, we won't be able to move past the onboarding screen until Stripe is configured.

Last updated on