Home > Net >  "detail": "Authentication credentials were not provided." when I want to signup
"detail": "Authentication credentials were not provided." when I want to signup

Time:10-05

when I want to post data and create a new teacher it gives me this error and I don't know what to do please help me

this is my models.py enter image description here

this is my views.py enter image description here

this is my serializer.py enter image description here

CodePudding user response:

You need to edit your settings.py and add this :

  REST_FRAMEWORK = {
   'DEFAULT_AUTHENTICATION_CLASSES': (
       'rest_framework.authentication.TokenAuthentication',
   ),
   'DEFAULT_PERMISSION_CLASSES': (
        'rest_framework.permissions.IsAdminUser'
   ),
}

But have look for better insight https://www.django-rest-framework.org/api-guide/settings/

  • Related