Skip to content
Advertisement

Forbidden: /api/v1.0/user/create-user/ & { “detail”: “Authentication credentials were not provided.” } DJANGO

I was creating Login functionality for my Python Django backend, “create user” functionality was working fine before. But then after Login was entirely coded, the create-user stopped working.

My urls.py file:

JavaScript

My views.py file:

JavaScript

My serializers.py file:

JavaScript

My project’s settings.py file:

JavaScript

Postman Request:

enter image description here

I get the same for when I tried to log in an existing user, after which I tried creating a new one, thinking I had forgotten the password.

Command Line looks like this:

enter image description here

What am I missing or doing wrong? Please guide!

Advertisement

Answer

You need to add permission_classes in UserView. It should contain AllowAny so that the api without authentication is allowed.

JavaScript
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement