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

JSONWebTokenAuthentication object has no attribute 'media_type' #466

@yutaroyamanaka

Description

@yutaroyamanaka

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions