Monday, July 6, 2015

How to protect a view with client ID and client secret in REST / oauth toolkit?

Say I have a REST view:

class CreateUserView(generics.CreateAPIView):
    serializer_class = CreateUserSerializer
    queryset = User.objects.all()

...how is it possible to protect the view with the client ID and client secret from the oauth toolkit?

So that I can invoke the view via a special request like:
curl -X POST http://127.0.0.1:8000/user-create/ -d "client_id=<client_id>&client_secret=<client_secret>&username=andrew&password=andrew&first_name=Andrew&last_name=Bonvix"

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/51dde18e-8cbf-4df8-af58-013bc93f9b8f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment