CSRF 重定向后 SSO Django 失败

CSRF Failed SSO Django after redirect

我正在尝试为我的 Django 应用程序配置 Google 的 SSO。 Google 是身份提供者,我的应用程序是服务提供者。我正在使用 python3-saml for the SSO and I used the files like in the django demo。每当我单击登录时,Google 都会尝试登录,但它 returns 显示 csrf verification has failed 的 403。知道我应该在哪里看吗?

对于文件,我使用了与上述演示中描述的完全相同的文件。

我 'fixed' 它通过使用呈现响应的装饰器 @csrf_exempt 绕过对视图的 csrf 检查。无法设置 csrf cookie,因为 POST 来自第 3 方(Google,在这种特殊情况下)并且在这里没有必要,因为 SAML 已经检查了响应。参见:https://github.com/onelogin/python3-saml/issues/146