How to add DRF token auth to swagger docs? It is not clear in the document as to how it should be declared.
SWAGGER_SETTINGS = {
'SECURITY_DEFINITIONS': {
'DRF Token': {
'type': 'apiKey',
'name': 'Authorization',
'in': 'header'
}
}
}
should be enough. You'll have to manually add the Token prefix (or whatever you set) to the token input in swagger-ui.
@axnsan12 the class TokenAuthentication from drf already use the Token prefix so it shouldn't be used as default on drf-yasg?
Is there anything in the docs that show how to add the token prefix to the ui input?
Most helpful comment
should be enough. You'll have to manually add the
Tokenprefix (or whatever you set) to the token input inswagger-ui.