20π
β
I think Iβve found the solution.
In the settings.py
, I added the following settings:
SWAGGER_SETTINGS = {
'SECURITY_DEFINITIONS': {
'api_key': {
'type': 'apiKey',
'in': 'header',
'name': 'Authorization'
}
},
}
Then when I load the page, I just click on the Authorize button at the upper right and enter this value in the value text field:
Token <valid-token-string>
However, I still needed to set the permission class of the schema view
to AllowAny
. The auth token just let me switch from different users, allowing me to view different set of endpoints.
π€Melvic Ybanez
0π
Isnβt there a way to login as an admin, or any other user to view the docs.
If your only use token authentication, first create tokens for your users, then access the resources by setting the header
curl -X GET http://127.0.0.1:8000/api/example/ -H 'Authorization: Token 9944b09199c62bcf9418ad846dd0e4bbdfc6ee4b'
π€Windsooon
- Performing non-blocking requests? β Django
- Celery: clean way of revoking the entire chain from within a task
- 504 Gateway Time-out uwsgi + nginx django application
Source:stackexchange.com