Join us and get access to hundreds of tutorials and a community of expert Pythonistas.

Unlock This Lesson

This lesson is for members only. Join us and get access to hundreds of tutorials and a community of expert Pythonistas.

Unlock This Lesson

Hint: You can adjust the default video playback speed in your account settings.
Hint: You can set the default subtitles language in your account settings.
Sorry! Looks like there’s an issue with video playback 🙁 This might be due to a temporary outage or because of a configuration issue with your browser. Please see our video player troubleshooting guide to resolve the issue.

Creating a GitHub App

To create your GitHub Oauth application, you’ll need to log in to GitHub then go to

00:00 Creating a GitHub Application. To use GitHub authentication with Django user management, you’ll first have to create an application. Log in to your GitHub account and go to the URL seen on-screen and fill in the form.

00:28 The most important part here is the authorization callback URL. It needs to point back to your application. After you’ve registered the application, you’ll be redirected to a page with settings for the application.

00:43 You need to generate a new Client Secret to allow Django social-auth to use GitHub. So click the button, scroll down, and copy the Client Secret to somewhere secure. As GitHub informs you, you won’t be able to see it again. So make sure you don’t skip this step.

01:02 Add the values of Client ID and Client Secret as environment variables.

01:20 Next, add them to settings the same way you added the Mailgun email credentials.

01:44 You can now check if this works. Log out of GitHub and go to your application’s dashboard page. Make sure you’re logged out. The page should say Hello, Guest!.

01:57 And select the option to log in with GitHub. Assuming you’ve logged out after creating the application in that previous step, you should be redirected to GitHub’s login page.

02:12 In the next step, you’ll be asked to authorize the GitHub application. If you confirm, you’ll be redirected back to your application. You can now find a new user in the admin panel.

02:27 The newly created user has the same username as your GitHub handle and doesn’t have a password. In the next section of the course, we’ll take a look at how to fix a problem that’s been created by enabling the GitHub login.

patientwriter on April 23, 2022

What if I already have a social namespace for my users social network? How easy is it to have oauth or whatever use a different namespace?

osiris on May 8, 2022

Note that callback URL with “localhost” does not work and will result in the following error: “social_core.exceptions.AuthFailed: Authentication failed: The redirect_uri MUST match the registered callback URL for this application.”

Use instead of “localhost”.

Become a Member to join the conversation.