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

JWT authentication is not working with latest version of Django RestFramework

Open RanaAsadFiaz opened this issue 7 years ago • 7 comments

JSON web token authorization lib is not working in the latest django rest framework and it is also defined in the official docs of it. I have searched many ways but for that i'll have to revert my version of django but that will crash my app because i am using latest features that were included in the django restframework. If you have any solution related to this then refer me instead of changing the version of python or django.

RanaAsadFiaz avatar Dec 06 '18 05:12 RanaAsadFiaz

GetBlimp/django-rest-framework-jwt is abandoned and has been removed from DRF docs

mscansian avatar Jan 21 '19 12:01 mscansian

I'm using it with the latest version of DRF and it works fine for me. What issue are you running into?

Alex3917 avatar Mar 07 '19 01:03 Alex3917

for me i run into the same issue

  • i have no apache in my setup -settings.py : REST_FRAMEWORK = { 'DEFAULT_AUTHENTICATION_CLASSES': ( 'rest_framework_jwt.authentication.JSONWebTokenAuthentication', ) } urls.py: path(r'api-token-auth/', obtain_jwt_token), path(r'api-token-verify/', verify_jwt_token), Screenshot from 2019-05-17 19-45-22

faridos avatar May 17 '19 17:05 faridos

I'm not sure what exactly the problem is here. The way I make requests in Postman, which still works, is as follows: When making a request to the endpoint api-token-auth, add these two lines in the Tests tab in Postman:

var data = JSON.parse(responseBody);
postman.setEnvironmentVariable("Authorization", "JWT " + data.token);

Then create a global environment variable called Authorization that gets included with each request. Then you just need to refresh the token every so often when it expires.

Alex3917 avatar May 17 '19 18:05 Alex3917

Removal from DRF docs https://github.com/encode/django-rest-framework/pull/6138

Issue with django-rest-framework-jwt https://github.com/encode/django-rest-framework/issues/5838

mscansian avatar May 17 '19 21:05 mscansian

https://github.com/Styria-Digital/django-rest-framework-jwt is a drop-in updated replacement fork with CI testing against recent Django and DRF

jayvdb avatar Jul 08 '19 07:07 jayvdb

for me i run into the same issue

* i have no apache in my setup
  -settings.py :
  REST_FRAMEWORK = {
  'DEFAULT_AUTHENTICATION_CLASSES': (
  'rest_framework_jwt.authentication.JSONWebTokenAuthentication',
  )
  }
  urls.py:
  path(r'api-token-auth/', obtain_jwt_token),
  path(r'api-token-verify/', verify_jwt_token),
  ![Screenshot from 2019-05-17 19-45-22](https://user-images.githubusercontent.com/3405806/57946737-5b841880-78dd-11e9-83f8-ca7a62d50a8a.png)

I have also the same problem. Did you found any solution.

yashkundu avatar Apr 18 '20 11:04 yashkundu