About Verifying Users by Social Login

If you consider social login to be a sufficient factor for user verification, here's how you can do that with django-allauth, considering that you use a custom User model with is_verified boolean field:

myproject/apps/accounts/social.py

def verify_user(signal, sender, instance, created=False, **kwargs):
    if (user := instance.user) and (data := instance.extra_data):
        is_verified = False
        if instance.provider == "google":
            is_verified = (
                user.first_name == data.get("given_name")
                and user.last_name == data.get("family_name")
                and data.get("email_verified")
            )
        elif instance.provider == "github":
            is_verified = (
                user.get_full_name() == data.get("name")
                and data.get("two_factor_authentication")
            )
        if is_verified and not user.is_verified:
            user.is_verified = True
            user.save(update_fields=["is_verified"])

myproject/apps/accounts/apps.py

from django.apps import AppConfig
from django.utils.translation import gettext_lazy

class AccountsConfig(AppConfig):
    name = "myproject.apps.accounts"
    verbose_name = _("Accounts")

    def ready(self):
        from django.db.models.signals import post_save
        from allauth.socialaccount.models import SocialAccount
        from .social import verify_user

        post_save.connect(verify_user, sender=SocialAccount)

Tips and Tricks Development Django 5.x Django 4.2 Django 3.2 django-allauth