djangooauthuserinfo

How to get the user details from social_django? And print all the details of all the users


I want to get the detail of all the users those who have login through google oauth and want to print all the details for my project.

I am just getting the detail of the current user who have login using the google login.


Solution

  • To list all the users signed in using google

    from social_django.models import UserSocialAuth
    # select_related for performance.
    google_logins = UserSocialAuth.objects.select_related("user").filter(provider="google-oauth2")
    for google_login in google_logins:
        print(google_login.user.pk, google_login.user.email)