Skip to content

Python social auth redirect to LOGIN_ERROR #435

@m-misseri

Description

@m-misseri

Hello,
I'm using a custom model:

from django.db import models
from django.contrib.auth.models import BaseUserManager, AbstractBaseUser, PermissionsMixin


GENDER_CHOICES = (
    ('M', 'Male'),
    ('F', 'Female'),
)

REGISTRATION_TYPE = (
    ('1', 'Normal'),
    ('2', 'Facebook'),
    ('3', 'Twitter')
)


class UserManager(BaseUserManager):

    def create_user(self, email, password, **kwargs):
        user = self.model(
            email=self.normalize_email(email),
            is_active=True,
            **kwargs
        )
        user.set_password(password)
        user.save(using=self._db)
        return user

    def create_superuser(self, email, password, **kwargs):
        user = self.model(
            email=email,
            is_staff=True,
            is_superuser=True,
            is_active=True,
            **kwargs
        )
        user.set_password(password)
        user.save(using=self._db)
        return user


class User(AbstractBaseUser, PermissionsMixin):

    objects = UserManager()
    USERNAME_FIELD = 'email'

    username = models.CharField(max_length=32, null=True, blank=True)
    email = models.EmailField(unique=True)
    is_active = models.BooleanField(default=False)
    is_staff = models.BooleanField(default=False)

    is_moderator = models.BooleanField(default=True)
    gender = models.CharField(max_length=1, choices=GENDER_CHOICES, null=True, blank=True)
    registration_type = models.CharField(max_length=1, choices=REGISTRATION_TYPE, null=True, blank=True)

    @property
    def facebook_uid(self):
        return self.social_auth.get(provider='facebook').uid

I'm getting error while I'm trying to logging with Facebook.
Simply it redirects to SOCIAL_AUTH_LOGIN_ERROR_URL = '/login-error/'

Any way to get a detailed error?

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions