Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple authentication not honored on initial schema request #10129

Open
stefanofusai opened this issue Sep 10, 2024 · 0 comments
Open

Multiple authentication not honored on initial schema request #10129

stefanofusai opened this issue Sep 10, 2024 · 0 comments

Comments

@stefanofusai
Copy link

Dear Swagger team, thanks for your work!

I'm unfortunately experiencing a ux-breaking issue for my product.
My need is to allow multiple authentication types, as described here:

  • Some endpoints only require the ApiKeyAuth authentication method
  • Other endpoints require the ApiKeyAuth AND jwtAuth authentication methods

The issue I have is that when inputting both values in the Available authorization form:
image
Only the jwtAuth header (Authentication) is passed to the schema request that gets sent after I click Authorize, resulting in a schema with no endpoints (as the X-API-Key header is not being passed)

The behavior I'm looking for instead is for both headers to be sent to the schema if both are input in the Available authorizations form.
The weird thing is that if I try out the endpoints, I can see both headers being sent!

My openapi version is 3.0.3. My components section looks like this:

"components": {
    "securitySchemes": {
        "ApiKeyAuth": {
            "type": "apiKey",
            "in": "header",
            "name": "X-API-Key"
        },
        "jwtAuth": {
            "type": "http",
            "scheme": "bearer",
            "bearerFormat": "JWT"
        }
    }
}

And this is what the security section of my endpoints looks like:

"security": [
    {
        "ApiKeyAuth": []
    },
    {
        "ApiKeyAuth": [],
        "jwtAuth": []
    }
]

Thank you for the help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant