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

JWT authentication is not working with latest version of Django RestFramework #462

Open
RanaAsadFiaz opened this issue Dec 6, 2018 · 7 comments

Comments

@RanaAsadFiaz
Copy link

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.

@mscansian
Copy link

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

@Alex3917
Copy link
Contributor

Alex3917 commented Mar 7, 2019

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

@faridos
Copy link

faridos commented May 17, 2019

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

@Alex3917
Copy link
Contributor

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.

@mscansian
Copy link

mscansian commented May 17, 2019

Removal from DRF docs
encode/django-rest-framework#6138

Issue with django-rest-framework-jwt
encode/django-rest-framework#5838

@jayvdb
Copy link

jayvdb commented Jul 8, 2019

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

@yashkundu
Copy link

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.

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

6 participants