简体   繁体   English

创建可供登出用户访问的石墨烯突变(Django)

[英]Create graphene mutations accessible to logged out users (Django)

I am implementing a web application that uses a back-end implemented in Django with the API written in graphene GQL. 我正在实现一个Web应用程序,它使用在Django中实现的后端和使用石墨烯GQL编写的API。

I need to provide login / logout functionality. 我需要提供登录/注销功能。 These should be (ideally) implemented as mutations. 这些应该(理想地)实现为突变。

The login mutation should be able to operate without an authentication token (of course, since the user is not yet logged in). 登录变异应该能够在没有身份验证令牌的情况下运行(当然,因为用户尚未登录)。

I do not want to disable csrf checks for the whole api (via csrf_exempt on the graphene view). 我不想禁用整个api的csrf检查(通过石墨烯视图上的csrf_exempt )。

Is there a way to disable csrf checks only for one mutation (login in my case) ? 有没有办法只针对一个突变禁用csrf检查(在我的情况下登录)?

Theres is a django app that can help you do that. Theres是一个django应用程序,可以帮助您做到这一点。 Check this https://github.com/morgante/django-graph-auth 请查看此https://github.com/morgante/django-graph-auth

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM