Search code examples
pythondjangodjango-socialauth

How to know whether login using social account or website login in Django


I'm develop the site using Django and am using django social_auth API for social login authentication. Here in my website no need to display the change password option when am login using social account. So how to hide that option when am login with social account. OR If there is any possibility to know whether login using social account or website login. Kindly let me know if you have an idea to solve this issue. Thanking you.


Solution

  • A simple solution (when someone don't know the actual implementation) can be

    1. Create a new table with user as foreign key and one more column with will work as flag for type of authentication.
    2. The flag can be 1 for django user and 2 for social auth user
    3. While creating the user in your system populate this table accordingly.
    4. Hide the option of change the password on the basis of same table.