OpenAPITools / openapi-generator

OpenAPI Generator allows generation of API client libraries (SDK generation), server stubs, documentation and configuration automatically given an OpenAPI Spec (v2, v3)
https://openapi-generator.tech
Apache License 2.0
22.14k stars 6.62k forks source link

C# Client Library when generated through openapi-generator-cli adds two authorization headers #9872

Open ng13548 opened 3 years ago

ng13548 commented 3 years ago

We have created a microservice using nest js. we are using openapi-generator-cli to generate client sdks. We are using swagger to consume open api definition. We have configured OAuth2 for 'Try it out' on Swagger UI to work with protected routes and also configured bearer Auth using documentbuilder.addOAuth2().addBearerAuth(). While generating client SDK for angular apps, it works perfectly fine - image But while generating client SDK in C# dotnet core using "openapi-generator-cli generate -g csharp-netcore -o XYZ/ -i openApi.json --additional-properties packageName=XYZ", we are unable to use it since two authorization headers were added in the generated code. It returns 401 on every API call through client SDK. image

Open API Generator Version - 2.3.5

https://github.com/OpenAPITools/openapi-generator-cli/issues/394

Blackclaws commented 3 years ago

Do you have an openapi file that we can take a look at?