简体   繁体   English

drf-yasg - 如何自定义持久身份验证令牌?

[英]drf-yasg - How to customize persistent auth token?

I am using drf-yasg to generate open API, what I want is once I have added the token for authentication it should be persistent and should not expire when user refreshes the page.我正在使用 drf-yasg 生成开放 API,我想要的是一旦我添加了用于身份验证的令牌,它应该是持久的,并且在用户刷新页面时不应过期。 Currently if user refreshes the page the token gets lost and user again needs to enter the token again and again after any single change.目前,如果用户刷新页面,令牌会丢失,并且用户在任何一次更改后都需要一次又一次地输入令牌。

when using drf-yasg, you can configure settings in SWAGGER_SETTINGS in your settings.py .使用 drf-yasg 时,您可以在 settings.py 中的 SWAGGER_SETTINGS 中配置设置 add 'PERSIST_AUTH': True into SWAGGER_SETTINGS would work.'PERSIST_AUTH': True添加到 SWAGGER_SETTINGS 中即可。

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

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