Skip to content
This repository has been archived by the owner on May 26, 2020. It is now read-only.

please pass request param to django.contrib.auth.authenticate #455

Open
mqinbin opened this issue Aug 17, 2018 · 2 comments
Open

please pass request param to django.contrib.auth.authenticate #455

mqinbin opened this issue Aug 17, 2018 · 2 comments

Comments

@mqinbin
Copy link

mqinbin commented Aug 17, 2018

for some reason i want to use "request" in AUTHENTICATION_BACKENDS
but i got request as None

i need request because:

  1. shopping cart is in cookie before login
  2. shoping cart is in server after login
  3. i want to decorate anywhere when login ( logon 、login 、oauth2)
  4. in my decoration : i get user from request
  5. i write a new AUTHENTICATION_BACKENDS give User to request as user property
    no request no user

just change you serializers line 50
from
user = authenticate(**credentials)
to
user = authenticate(self.context["request"] , **credentials)

thanks

@ehmadzubair
Copy link

@jpadilla If i create a PR, will this be merged?

@string-areeb
Copy link

string-areeb commented Aug 8, 2019

No, most likely not. Project hasn't been updated for 2 years. #484 Use https://github.com/davesque/django-rest-framework-simplejwt/ or https://github.com/Styria-Digital/django-rest-framework-jwt instead

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants