RapiDoc icon indicating copy to clipboard operation
RapiDoc copied to clipboard

Authorization Code Flow Isn't Sending Required Information in the /token Request

Open bleish opened this issue 4 years ago • 1 comments

We have our swagger spec set up to include a security scheme with an authorization code flow. The /authorize request works fine in retrieving the code, however, the /token request fails. Our spec works fine with Swagger UI, and when comparing the payload of the /token request with RapiDoc's, we've found that RapiDoc isn't including the scope query parameter, nor the client_id and client_secret in the form data. I'm not sure if this is a bug in RapiDoc, or if we've missed a step, but we've followed the documentation, and can't find anything else beyond what we've already included in the spec file. Any help here would be appreciated.

Our swagger spec has the following security scheme:

"securitySchemes": {
  "Identity Server": {
    "type": "oauth2",
    "flows": {
      "clientCredentials": {
        "authorizationUrl": "https://our-identity-url/authorize",
        "tokenUrl": "https://our-identity-url/token",
        "scopes": {
          "our_scope": "Our Scope"
        }
      },
      "authorizationCode": {
        "authorizationUrl": "https://our-identity-url/authorize",
        "tokenUrl": "https://our-identity-url/token",
        "scopes": {
          "our_scope": "Our Scope"
        }
      }
    }
  }
}

The Swagger UI /token Request:

https://our-identity-url/token?scope=our_scope
grant_type: authorization_code
code: <code>
client_id: <our-client-id>
client_secret: <our-client-secret>
redirect_uri: http://our-app-url/oauth2-redirect.html
code_verifier: <code-verifier>

The RapiDoc /token Request:

https://our-identity-url/token
grant_type: authorization_code
redirect_uri: http://our-app-url/oauth-receiver.html
code: <code>
code_verifier: <code-verifier>

bleish avatar Sep 14 '22 20:09 bleish

test it using https://rapidocweb.com/examples/oauth-demo.html (in this example when requesting token make sure that you have selected openid scope)

if you like to test it with your spec then pick rapidoc-min.js (beta) from the dist folder of this repo

mrin9 avatar Sep 15 '22 04:09 mrin9