Swagger安全性定义-clientCredentials流

时间:2019-07-23 20:09:00

标签: oauth-2.0 graphql swagger swagger-ui

我有一个基于graphQL的身份验证API。它在标头中使用了subscription_key,content-type,并且HTTP post消息的正文如下所示。

{
getAccessToken(clientId: "xxx",
    clientSecret: "yyy") 
    {
    accessTokenFormat
    accessToken
    expiresOn
  }
}

它返回accessTokenFormat,accessToken,expiresOn,它们随后在OAuth 2.0客户端凭据流中用于访问API资源。

我很难在swagger编辑器中描述它。这是我的招摇的定义。


securityDefinitions:
  caqh_auth:
    type: "oauth2"
    tokenUrl: "https://someURL/graphql"
    flow: "application"
    scopes:
      read:roster: "read your roster"
  api_key:
    type: "apiKey"
    name: "subscription-key"
    in: "header"
  content_type:
    type: "apiKey"
    name: "Content-Type"
    in: "header"
  body:
    type: "apiKey"
    name: "getAccessToken"
    in: "body" => Resulting in an error

上面的主体部分在swagger编辑器中导致错误。用yaml描述身体部位的正确语法是什么?

在摇摇欲坠的编辑器中尝试了多种方法,但是没有运气。

0 个答案:

没有答案