luckymarmot / Paw-OpenAPI3Importer

OpenAPI 3 (Swagger 3) Importer for Paw
MIT License
18 stars 3 forks source link

`Paw-OpenAPI3Importer` doesn't set "Grant Type" in Auth -> OAuth2 properly, when importing an endpoint with a security definition. #14

Open paw-eloquent-safe opened 2 years ago

paw-eloquent-safe commented 2 years ago

Imagine we have the following OpenAPI definition:

{
    "openapi": "3.0.1",
    "info": {
      "title": "Example Api",
      "version": "v1"
    },
    "servers": [
      {
        "url": "https://example.org/",
        "description": "Example Server"
      }
    ],
    "paths": {
      "/users/register": {
        "post": {
          "tags": [
            "Users"
          ],
          "security": [
            {
              "oauth2-client-flow": []
            }
          ],
          "requestBody": {
            "content": {
                ...
            }
          },
          "responses": {
            "200": {
              "description": "Success"
            }
          }
        }
      }
    },
    "components": {
      "schemas": {
          ...
        },
      "securitySchemes": {
        "oauth2-client-flow": {
          "type": "oauth2",
          "flows": {
            "clientCredentials": {
              "tokenUrl": "https://example.org/auth/connect/token",
              "scopes": {}
            }
          }
        }
      }
    },
    "security": [
      {
        "oauth2-client-flow": []
      }
    ]
  }

Then when importing this I expect the "Grant Type" in Auth -> OAuth2 for /users/register to be set to "Client Credentials" with the "Acces Token URL" to be filled.

Instead it looks like this:

Screenshot 2022-06-09 at 12 04 58

While I expected this:

Screenshot 2022-06-09 at 12 09 10

Same story goes for all of the other flows. (I think, didn't test it, tho)

pongstr commented 2 years ago

hey @k-visscher thanks for reporting this, I looked around and couldn't find an API that can programmatically set the Grant-Type according to the schema. I'll ask around within the Team and see if they can point me to the right direction.