Open yutaroyamanaka opened 5 years ago
Hi, I tried to use 'obtain_jwt_token' , but it didn't go well.
Environment djangorestframework==3.9.0 djangorestframework==1.11.0
This is the setting about drf-jwt
REST_FRAMEWORK = { 'DEFAULT_PERMISSION_CLASSES': ( 'rest_framework.permissions.IsAuthenticated', ), 'DEFAULT_AUTHENTICATION_CLASSES': ( 'rest_framework_jwt.authentication.JSONWebTokenAuthentication', 'rest_framework.authentication.SessionAuthentication', 'rest_framework.authentication.BasicAuthentication', ), }
from django.urls import path from rest_framework_jwt.vies import obtain_jwt_token urlpatterns = [ ..., path('token-auth/', obtain_jwt_token), ]
I think it is totally the same as usage in 'django-rest-framework-jwt/docs/index.md' Then, I tried to send http request to localhost://token-auth/
curl -X POST -d "username=admin&password=password123" http://localhost:8000/token-auth/
However, the response was 'JSONWebTokenAuthentication object has no attribute 'media_type''
So, I changed the setting as follows.
rest_framework_jwt.authentication.JSONWebTokenAuthentication → rest_framework.parsers.JSONParser
and then The response was 'SessionAuthentication object has no attribute 'media_type''.
I don't know how to fix this situation. I'll be glad if someone would help me.
Hi, I tried to use 'obtain_jwt_token' , but it didn't go well.
Environment djangorestframework==3.9.0 djangorestframework==1.11.0
This is the setting about drf-jwt
I think it is totally the same as usage in 'django-rest-framework-jwt/docs/index.md' Then, I tried to send http request to localhost://token-auth/
However, the response was 'JSONWebTokenAuthentication object has no attribute 'media_type''
So, I changed the setting as follows.
and then The response was 'SessionAuthentication object has no attribute 'media_type''.
I don't know how to fix this situation. I'll be glad if someone would help me.