我使用django、django rest框架和余烬;我的整个应用程序通过ajax进行通信。在
身份验证通过oauth2完成,并且在每个请求的头中发送一个令牌。在
所有的一切都很好,闪亮,但文件下载。在
用户可以下载pdf文件,但我不知道如何在那里应用身份验证-因为在文件下载时,我无法发送和邮件头,它只是一个链接。在
我曾想过向特定的restapi调用添加SessionAuthentication,但会话总是将传入用户标记为anyonymous。在
如何强制django在oauth2令牌流上创建会话?在
我试过login(request, user)
,但不知怎么的它没有起作用。在
最后我得到了签名的票证,例如,我发回一个令牌,它可以在规定的时间范围内绕过auth。因此,ajax应用程序可以首先请求令牌,然后再使用附加的令牌来触发一个标准的get请求。在
以下是我融合到视图中的基本思想:
相关问题 更多 >
编程相关推荐