python-social-auth / social-app-django

Python Social Auth - Application - Django
BSD 3-Clause "New" or "Revised" License
2.03k stars 380 forks source link

Custom pipeline or extend user model #71

Open lucienbaumann opened 7 years ago

lucienbaumann commented 7 years ago

Hi,

I am implementing social-app-django with django 1.11 (not using Mongo). My application will need to store and manipulate a lot of data on users other than that which is fetched from their social media accounts at login. I don't need to fetch or collect any extra data when the user authenticates, but various actions they perform on my site will need to be saved to their user. I am wondering which of the following approaches is preferred (I've searched extensively online, but can't find a specific explanation of the differences):

Do these two methods essentially achieve the same thing? Is one more reliable/preferred for some reason? Or, should I be doing both? Thanks very much for any assistance.

Oh, and one more thing--I would like to be able to access the User database not only from the app I am currently building, but also from other apps (within the same Django project) that I will build in the future. Does this affect anything?

h1nk commented 5 years ago

I agree there really needs to be some clarification about the use of the SOCIAL_AUTH_USER_MODEL setting. I'm confused as to where and how the value of SOCIAL_AUTH_USER_MODEL is even used in the library and also how it differs from Django's own AUTH_USER_MODEL setting. There's little said in the documentation about how to actually use SOCIAL_AUTH_USER_MODEL with a custom model besides saying that it requires the username and email model fields to be present. I made a custom Django Social Auth user model and set SOCIAL_AUTH_USER_MODEL to it but whenever I'm logged into Django admin I get a conflict:

ValueError: Cannot query "<staff superuser name>": Must be "<SOCIAL_AUTH_USER_MODEL model class>" instance.

Perhaps the python-social-auth/social-examples repository can add a full example in which SOCIAL_AUTH_USER_MODEL is used to point to a separate model than AUTH_USER_MODEL.

h1nk commented 5 years ago

If it's possible I'd ideally like keep complete separation between Django staff/Django Users and Django Social Auth users that I integrate into my custom model, but allow simultaneous login to Django Admin and Django Social Auth. So basically 2 entirely separate authentication systems.

raghav-kukreti commented 5 years ago

Hello, any updates on this?

08-zimmad commented 2 months ago

hey, I am getting the same issue, there's too much on the plate to understand in order to configure drf-social-oauth2 with my Custom auth model. I am using User model too for saperate purposes. any one who knows how to deal with this situation let me know.