Django Allauth (5) – Social Login with GitHub

This lesson will explain how to set up a social login with GitHub. The approach can change depending on GitHub's policy. This approach is valid as of April 2023.

1. Register a new OAuth app on the GitHub website

Go to your GitHub account page to set up a new OAuth app. Open the menu from the user icon on the top right. Select Settings.

Register a new OAuth app in GitHub website: Step 1

Select Developer settings on the left sidebar.

Register a new OAuth app in GitHub website: Step 2

Clicks on the Register a new application button under the OAuth Apps menu.

Register a new OAuth app in GitHub website: Step 3

There are three items you need to type in.

  • App Name: Employee Learning (any name)
  • Homepage URL: http://localhost:8000
  • Authorization callback URL: http://localhost:8000/accounts/github/login/callback/

You need to type the Homepage URL and callback URL carefully. Often, errors come from this setting. If you are using 127.0.0.1 for the runserver command, use 127.0.0.1 here as well. Another point you need to be careful about is the accounts part. Don't forget to put s at the end.