Search code examples
python-3.xdjangodjango-rest-frameworkswaggerswagger-ui

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. 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.


Solution

  • When using drf-yasg, you can configure settings in SWAGGER_SETTINGS in your settings.py. add 'PERSIST_AUTH': True into SWAGGER_SETTINGS would work.