-
-
Notifications
You must be signed in to change notification settings - Fork 6.6k
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
[typescript-axios] Generating bearerAuth create Basic auth instead #1446
Comments
Hi, This issue exists for typescript-angular too.
And my generated code:
|
Python too #1577 |
This issue exists for |
See OpenAPITools#457 Also OpenAPITools#1446 for typescript, OpenAPITools#1577 for python Specs defined as follows currently generate BasicAuth and send "Authorization: Basic [base64Encode(username + ":" + password)]" components: securitySchemes: bearer: type: http scheme: bearer This change will generate an OAuth header, which will send a "Authorization: Bearer [accessToken]" This is a smaller, less-impactful change than introducing a BearerAuth object, but this change doesn't support scheme values other than bearer See also OpenAPITools#1930
See OpenAPITools#457 Also OpenAPITools#1446 for typescript, OpenAPITools#1577 for python Specs defined as follows currently generate BasicAuth and send an "Authorization: Basic [base64Encode(username + ":" + password)]" header components: securitySchemes: bearer: type: http scheme: bearer This change will generate code which uses a new HttpBearerAuth class, which will send a "Authorization: [scheme] [accessToken]" header. This change is slightly larger and more impactful than simply using OAuth for bearerBearer, but it allows for scheme values other than bearer. This fix was enabled by the recent commit of OpenAPITools@80ca67c This PR is an alternative to OpenAPITools#1972
* fix #457 by introducing an HttpBearerAuth object See #457 Also #1446 for typescript, #1577 for python Specs defined as follows currently generate BasicAuth and send an "Authorization: Basic [base64Encode(username + ":" + password)]" header components: securitySchemes: bearer: type: http scheme: bearer This change will generate code which uses a new HttpBearerAuth class, which will send a "Authorization: [scheme] [accessToken]" header. This change is slightly larger and more impactful than simply using OAuth for bearerBearer, but it allows for scheme values other than bearer. This fix was enabled by the recent commit of 80ca67c This PR is an alternative to #1972 * update petstore samples * Update HttpBearerAuth mustache templates and samples * correct the expected number of generated java client files * update the retrofit2 HttpBearerAuth template and samples * Add resttemplate-specific HttpBearerAuth mustache and samples * add vertx-specific HttpBearerAuth template and samples * add java webclient-specific HttpBearerAuth template and samples
* fix OpenAPITools#457 by introducing an HttpBearerAuth object See OpenAPITools#457 Also OpenAPITools#1446 for typescript, OpenAPITools#1577 for python Specs defined as follows currently generate BasicAuth and send an "Authorization: Basic [base64Encode(username + ":" + password)]" header components: securitySchemes: bearer: type: http scheme: bearer This change will generate code which uses a new HttpBearerAuth class, which will send a "Authorization: [scheme] [accessToken]" header. This change is slightly larger and more impactful than simply using OAuth for bearerBearer, but it allows for scheme values other than bearer. This fix was enabled by the recent commit of OpenAPITools@80ca67c This PR is an alternative to OpenAPITools#1972 * update petstore samples * Update HttpBearerAuth mustache templates and samples * correct the expected number of generated java client files * update the retrofit2 HttpBearerAuth template and samples * Add resttemplate-specific HttpBearerAuth mustache and samples * add vertx-specific HttpBearerAuth template and samples * add java webclient-specific HttpBearerAuth template and samples
It was generated the same as Basic authentication. Now we handle both cases differently. Fix OpenAPITools#1446
* [typescript-axios] Fix Bearer authentication It was generated the same as Basic authentication. Now we handle both cases differently. Fix #1446 * [typescript-axios] Bearer authentication : use config.accessToken instead of config.password As it is done in the angular client: https://github.com/OpenAPITools/openapi-generator/blob/0889b8ec1349d6f912ad7dfa221d3980f1801dba/modules/openapi-generator/src/main/resources/typescript-angular/api.service.mustache#L213-L220
I still see the same issue in NPM wrapper and latest docker image (generated 7 hours ago). Issue exists in typescript-fetch. |
i am using npm wrapper and still not able to get bearer auth templates |
Is this fixed? I am trying to generate clients using it and it does not generate the setter the Bearer header. |
* fix #457 by introducing an HttpBearerAuth object See OpenAPITools/openapi-generator#457 Also OpenAPITools/openapi-generator#1446 for typescript, OpenAPITools/openapi-generator#1577 for python Specs defined as follows currently generate BasicAuth and send an "Authorization: Basic [base64Encode(username + ":" + password)]" header components: securitySchemes: bearer: type: http scheme: bearer This change will generate code which uses a new HttpBearerAuth class, which will send a "Authorization: [scheme] [accessToken]" header. This change is slightly larger and more impactful than simply using OAuth for bearerBearer, but it allows for scheme values other than bearer. This fix was enabled by the recent commit of OpenAPITools/openapi-generator@80ca67c This PR is an alternative to OpenAPITools/openapi-generator#1972 * update petstore samples * Update HttpBearerAuth mustache templates and samples * correct the expected number of generated java client files * update the retrofit2 HttpBearerAuth template and samples * Add resttemplate-specific HttpBearerAuth mustache and samples * add vertx-specific HttpBearerAuth template and samples * add java webclient-specific HttpBearerAuth template and samples
* fix #457 by introducing an HttpBearerAuth object See OpenAPITools/openapi-generator#457 Also OpenAPITools/openapi-generator#1446 for typescript, OpenAPITools/openapi-generator#1577 for python Specs defined as follows currently generate BasicAuth and send an "Authorization: Basic [base64Encode(username + ":" + password)]" header components: securitySchemes: bearer: type: http scheme: bearer This change will generate code which uses a new HttpBearerAuth class, which will send a "Authorization: [scheme] [accessToken]" header. This change is slightly larger and more impactful than simply using OAuth for bearerBearer, but it allows for scheme values other than bearer. This fix was enabled by the recent commit of OpenAPITools/openapi-generator@80ca67c This PR is an alternative to OpenAPITools/openapi-generator#1972 * update petstore samples * Update HttpBearerAuth mustache templates and samples * correct the expected number of generated java client files * update the retrofit2 HttpBearerAuth template and samples * Add resttemplate-specific HttpBearerAuth mustache and samples * add vertx-specific HttpBearerAuth template and samples * add java webclient-specific HttpBearerAuth template and samples
Description
Attempting to generate from an openapi definition with bearerAuth marked as the security schema. When it generates using axios-typescript it generates Basic auth security instead? It does generate a comment referencing Bearer auth but no code to add the header.
openapi-generator version
"@harmowatch/openapi-generator-cli": "0.0.3-3.3.2"
OpenAPI declaration file content or url
This generates
Command line used for generation
Generating through npm.
npm=6.2.0
node=v10.9.0
"generate": "openapi-generator generate -i api/myapi.yaml -g typescript-axios -o generated-sources/myapi"
Steps to reproduce
Running generate commmand.
Suggest a fix/enhancement
The text was updated successfully, but these errors were encountered: