Pyt*_*ast 5 python django swagger oauth2-toolkit django-swagger
我正在使用OAuthToolkit和 DjangoRestSwagger。我已经使用 Django Admin 创建了一个应用程序,现在我已经client_id和client_secret.
我想使用client_idand生成令牌client_secret。目前,我curl用来生成令牌。
curl -X POST -d "grant_type=client_credentials" -u"client_id:client_secret" http://localhost:8000/o/token/
Run Code Online (Sandbox Code Playgroud)
我如何使用 Swagger 文档来做到这一点?基本上,如何将第三方(OAuthToolkit)API URL 与 Swagger 集成?
目前,我有一个Authorize接受api_key价值的按钮,即令牌。
这是我的 Swagger 设置。
SWAGGER_SETTINGS = {
'SECURITY_DEFINITIONS': {
'token': {
'type': 'apiKey',
'name': 'AUTHORIZATION',
'in': 'header',
}
},
}
Run Code Online (Sandbox Code Playgroud)
不确定,django-rest-swagger但如果您正在寻找有保证支持的替代方案,oauth您可以使用drf-yasg(另一个大摇大摆的生成器)