Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 976
user2166524 Avatar asked Mar 13 '13 17:03

user2166524


1 Answers

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.

like image 155
user2166524 Avatar answered Oct 19 '22 07:10

user2166524