Github

INSTALLED_APPS = [
  
    'allauth.socialaccount.providers.github', # new (github provider)
 
]

GitHub OAuth

Now open https://github.com/settings/applications/new to get configure the OAuth app in GitHub. You will get a client ID and secret key.

Fill up the details and for

  • Homepage URL: http://localhost:8000/

  • Authorization callback URL: http://localhost:8000/accounts/github/login/callback/

Then click on Register application

Now log out yourself because you logged in as a superuser and open http://localhost:8000/accounts/login/ and you can see GitHub login option.

If you have customized django-allauth templates then you can directly use this code in your template.

{% load socialaccount %}

<h1>Django Allauth Tutorial</h1>

<a href="{% provider_login_url 'github' %}">Sign Up with GitHub</a>

Last updated