0

I am registering the user by using this post , In this case successfully i am creating the user.

After above step, I enabled token authentication by using this post, but the main problem is when i perform registration operation it is showing "detail": "Authentication credentials were not provided." this error.

Here i don't need authentication checking for user registration, need authentication checking for remaining apis.

Can anyone please help me out how to disable authentication for user registration.

Thanks in advance

1
  • My i know why down vote. there is no direct question in SO on this, and i checked about this in Django Rest framework documentation, there is no direct solution for this. If you find any direct link for my question, Please add in comment. Commented Dec 9, 2015 at 15:34

1 Answer 1

1

Depending on how you want your endpoint to be accessed and the level of publicity you can use 1 of 2 permissions.

Either AllowAny or IsAuthenticatedOrReadOnly

AllowAny will allow for anyone accessing each of the methods you've defined for the viewset.

IsAuthenticatedOrReadOnly will, by default, allow anyone to use the safe http methods GET, HEAD or OPTIONS on your endpoint but in order to POST, PUT/PATCH or DELETE you would need to be authenticated.

You add these to each of your endpoints for fine grained control

from rest_framework import permissions

class MyViewSet(viewsets.GenericViewSet):
    permissions_classes = (permissions.AllowAny, )
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.