How do I get Django 1.5 Custom User Model and Social Auth to work?
Asked Answered
V

1

7

Django Social Auth (0.7.22) is reported to support Custom User Models but I have no been able to get this to work.

In my case I am using Google's Oauth2 which I have working with a non-custom-user-model.

With the Custom User Model I get correctly redirected to the Google Account Page, select an account to login and then and redirected to the LOGIN_ERROR_URL, with no messages or debug info.

To simplify debugging I have created a simple example project with the bare minimum bits and pieces at https://github.com/jonathanendersby/SocialAuthCustomUserModel

Has anyone got this to work and can they point out where I have gone wrong?

Vex answered 13/3, 2013 at 17:6 Comment(0)
V
1

This issue is now resolved in the repo at https://github.com/jonathanendersby/SocialAuthCustomUserModel

Quoting https://github.com/omab:

The problem was the parameters that create_user() was getting, not all of them are available on all the backends.

By replacing the method signature with the same from django manager, and setting some default values into first_name and last_name fields in your model, it works OK.

Vex answered 14/3, 2013 at 2:10 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.