Selecting Auth Backend
00:00 Selecting an Authentication Backend.
00:05 There’s one problem with the example you’ve just seen. By enabling GitHub login, you accidentally broke the normal user creation process. This happened because Django previously had only one authentication backend to choose from, and now it has two. Django doesn’t know which one to use when creating new users. So you need to help it decide.
00:28
To do that, make the changes seen-on screen in the registration view. As before, a user is created from the form data, but this time it’s not immediately saved thanks to commit=False
. In the next line, a backend is associated with the user, and only then is the user saved to the database.
00:49 This way, you can use both normal user creation and social media authentication in the same Django user management system.
00:59 Now that you’ve covered everything in the course, in the next section, you’ll take a look back at what you’ve learned.
papaabramg on Feb. 24, 2025
After set Github lback URL
127.0.0.1:8000/oauth/complete/github/it worked. A comment above should habe been deleted but I can’t. Thank you.
Become a Member to join the conversation.
papaabramg on Feb. 23, 2025
Hello! When trying github login, it redirects to github.com/login/oauth/authorize?client_id=Ov23lihEbQPyS9tFWyuO&redirect_uri=https://127.0.0.1:8000/oauth/complete/github/&state=tPDqQOEKTfX0GB7kucmxDRJuXfJQNWf4&response_type=code
And github gives an error message: Be careful!
The redirect_uri is not associated with this application.
The application might be misconfigured or could be trying to redirect you to a website you weren’t expecting.
I understand it comes from redirect_uri=127.0.0.1:8000/oauth/complete/github/