D
D
Dmitry2016-12-12 00:30:11
Django
Dmitry, 2016-12-12 00:30:11

How to disable csrf validation when requesting an API from a mobile application in Django?

There is an API to the backend, a mobile application connects to the API.
When logging in I get:

{
  "detail": "CSRF Failed: CSRF cookie not set."
}

I use the django restauth module to manage

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Pinkevich, 2016-12-12
@pinkevich

For ordinary views, there is such a decorator:
And for class based views, it can be wrapped using method_decorator (apply to the dispatcher) or using the CsrfExemptMixin mixin, ( https://github.com/brack3t/django-braces)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question