开发者

CSRF verification failed, but only with Facebook App

I am creating a Facebook App using Django.

When I access my webpage directly then it works fine. I have then added this webpage as the Facebook canvas URL, so that users are directed to this page when they go to the App. Now, when I enter the App, I get the "CSRF verification failed" error. I think it's because facebook is doing a POST, but without the CSRF token. However, I cannot control how Facebook redirects to my App.

Anyone know how to deal with this?

This is all my View does:

def frontpage(request):
开发者_开发技巧    return render_to_response('tube/frontpage.html', {"s": 'hello'})

and frontpage.html just writes "front page!"


I figured it out:

from django.views.decorators.csrf import csrf_exempt

@csrf_exempt
def my_view(request):
    return HttpResponse('Hello world')
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜