I'm using OAuthToolkit and DjangoRestSwagger. I've created an application using Django Admin, and now I've client_id
and client_secret
.
I want to generate the token using client_id
and client_secret
. Currently, I use curl
to generate the token.
curl -X POST -d "grant_type=client_credentials" -u"client_id:client_secret" http://localhost:8000/o/token/
How can I do it using the Swagger docs.? Basically, how can integrate third party(OAuthToolkit) API URLs with Swagger?
Currently, I've an Authorize
button which takes api_key
value, ie the token.
Here's my Swagger settings.
SWAGGER_SETTINGS = {
'SECURITY_DEFINITIONS': {
'token': {
'type': 'apiKey',
'name': 'AUTHORIZATION',
'in': 'header',
}
},
}
Not certain about django-rest-swagger
but if you are looking for an alternative with gauranteed support for oauth
you can use drf-yasg
(yet another swagger generator)
Documentation for yasg adding oauth paths to swagger
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With