Pergunta de entrevista da empresa ErnieApp

Django REST framework provides CSRF protection. When should it be used?

Resposta da entrevista

Sigiloso

15 de abr. de 2020

CSRF should be used when using SessionAuthentication in order to make sure that only the AJAX requests from the same context as the API are allowed. If you want your API to be publicly available you should probably look at TokenAuthentication or implement your own authentication backend.