这是indexloc提供的服务,不要输入任何密码
Skip to content

Only first matching security is taken in client-fetch, possibly others as well #1768

@AmazingTurtle

Description

@AmazingTurtle

Description

See https://swagger.io/specification/#security-requirement-object
and see

Only the first matching security will be considered thus it omits the second auth.

  const client = createClient(
    createConfig({
      baseUrl,
      headers,
      auth: (auth) => {
        console.log('Auth is asking for', { auth });

        if (auth.name === 'Authorization') {
          return 'blabliblub'
        } else if (auth.name === 'another') {
          return 'this is never happening';
        }
      },
    }),
  );

For the moment I used patch-package again to get rid of the early return statement from utils.ts#L226:
https://gist.github.com/AmazingTurtle/8e55f199fbed3fae6959dc0d4ab862b8

Reproducible example or configuration

No response

OpenAPI specification (optional)

[...]

"security": [
  {
    "bearer": [],
    "another": []
  }
],

[...]

System information (optional)

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug 🔥Something isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions