django-rest-framework-jwt icon indicating copy to clipboard operation
django-rest-framework-jwt copied to clipboard

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

Open mqinbin opened this issue 6 years ago • 2 comments

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

mqinbin avatar Aug 17 '18 17:08 mqinbin

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

ehmadzubair avatar Aug 08 '19 08:08 ehmadzubair

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

string-areeb avatar Aug 08 '19 12:08 string-areeb