Skip to content

Social REST auth with REST_SESSION_LOGIN = True #64

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
vosi opened this issue Mar 31, 2015 · 3 comments
Open

Social REST auth with REST_SESSION_LOGIN = True #64

vosi opened this issue Mar 31, 2015 · 3 comments

Comments

@vosi
Copy link

vosi commented Mar 31, 2015

SocialLogin view class should have its own login method to assign some backend to user object, because dango.contrib.auth.login requires backend property, that usually is assigned by authenticate method

currently i've just made a dirty fix like this

class SocialLogin(OldSocialLogin):
    def login(self):
        # import ipdb; ipdb.set_trace()
        self.user = self.serializer.validated_data['user']
        self.token, created = self.token_model.objects.get_or_create(
            user=self.user)
        if getattr(settings, 'REST_SESSION_LOGIN', True):
            if not hasattr(self.user, 'backend'):
                self.user.backend = 'django.contrib.auth.backends.ModelBackend'
            login(self.request, self.user)

but im sure it is not the most beautiful solution

@yarbelk
Copy link

yarbelk commented Apr 6, 2015

+1

@nabeelvalapra
Copy link

Yeah!! It is also causing error, when trying to authenticate with Google.

@sww314
Copy link

sww314 commented Mar 20, 2017

+1
I am having the same problem using the SocialLogin code in examples (Facebook + Twitter).

steverecio pushed a commit to steverecio/django-rest-auth that referenced this issue Jun 3, 2020
change validation order in PasswordResetConfirmSerializer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants