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

Unlock This Lesson

This lesson is for members only. Join us and get access to thousands 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.

Setting Up Social Auth

00:00 Set Up Social Authentication. Start by installing the module.

00:19 As with any other Django application, you have to add it to INSTALLED_APPS. Notice that in this case, the name of the Django application is different from the name of the Python module.

00:35 Next add two context processors to the file.

00:58 With these steps complete, apply the migrations.

01:08 You will also need to include the social authentication URLs in your application, just as you did with the ones provided by Django. The steps so far have been a general configuration of Django. To use social authentication specifically with GitHub, you have to add a dedicated authentication backend.

01:35 By default, Django settings don’t specify authentication backends, and the default backend used by Django is django.contrib.auth.backends.ModelBackend.

01:44 So to use social authentication, you need to create a new value in settings. The first backend on the list is the default one used by Django. If you don’t include it here, then Django won’t be able to log in standard users.

02:04 The second backend is used for GitHub logins. The last thing to do is to add a link to the GitHub login on the login page.

02:22 You may notice that the new URL uses the namespace social. Namespaces our Django’s way of organizing URLs in more complex projects. Using a unique namespace ensures that there will be no conflicts between your application’s URLs and the URLs of other applications.

02:44 The social authentication application uses the namespace social, so every URL you want to use has to start with social:. In the next section of the course, you’ll see how to create a GitHub application to use with Django social authentication.

monikameher on Aug. 28, 2022

Running the migrate function throwing me the below error:

raise AppRegistryNotReady("Apps aren't loaded yet.")
django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet.

Can you suggest me how can I solve this error?

Darren Jones RP Team on Sept. 4, 2022

@monikameher - first place to look is make sure that your INSTALLED_APPS setting in doesn’t contain any typos or apps that don’t exist yet - Django may be trying to load an app that doesn’t exist because of this.

Become a Member to join the conversation.