我正在使用swagger构建API,到目前为止我创建了get / insert / update和delete作业,现在我正在尝试使用Oauth来保护我的API
我用过
securityDefinitions:
job_auth:
type: oauth2
authorizationUrl: http://localhost:10010/auth
flow: implicit
scopes:
write:jobs: modify jobs in your account
read:jobs: get your jobs
在我使用的/ get函数中 `路径:
/jobs:
# binds a127 app logic to a route
x-swagger-router-controller: job
get:
description: Returns the job list
# used as the method name of the controller
operationId: getAllJobs
responses:
"200":
description: Success
schema:
$ref: "#/definitions/GetJobsListResponse"
security:
- job_auth:
- read:jobs `
在swagger编辑器中,现在显示
安全 job_auth(OAuth 2.0)验证(按钮)
流隐含 授权网址http://localhost:10010/auth
作用域
写:工作会修改您帐户中的工作 阅读:工作得到你的工作
现在我想使用
访问职位列表但它给出了类似的东西
{ “message”:“未知安全处理程序:job_auth”, “code”:“server_error”, “statusCode”:403 }
任何人都可以帮助我如何访问http://localhost:10010/jobs并设置 正确地在Oauth中进行身份验证,我是这个新手