Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hercules: csrf exempt django rest framework

I have the following view:

@api_view(POST?)
@csrf_exempt
def user_login(request):

that adheres to the django rest framework.

How can I make this view csrf exempt?

I am trying to do API calls via iphone.

like image 401
user2237822 Avatar asked Oct 21 '22 10:10

user2237822


1 Answers

It looks like this forum post helps clarify.

https://groups.google.com/forum/?fromgroups=#!topic/django-rest-framework/JCf4MwNtfwM

According to it,

"REST framework views are CSRF exempt by default unless your using UserLoggedInAuthentication"

Are you actively experiencing a CSRF protection issue with REST Framework?

Joe

like image 190
Joe J Avatar answered Oct 27 '22 10:10

Joe J