From 9ef511a7a6d060848ea904af122d097c59202a9d Mon Sep 17 00:00:00 2001 From: johan-jnn Date: Tue, 2 Jun 2026 19:51:40 +0200 Subject: [PATCH] fix: Add support for bearer token authentication (v3) see https://github.com/swagger-api/swagger-codegen/issues/9493 --- .../resources/handlebars/typescript-fetch/api.mustache | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/main/resources/handlebars/typescript-fetch/api.mustache b/src/main/resources/handlebars/typescript-fetch/api.mustache index 1c84f1edcb..0e120b37d7 100644 --- a/src/main/resources/handlebars/typescript-fetch/api.mustache +++ b/src/main/resources/handlebars/typescript-fetch/api.mustache @@ -144,7 +144,15 @@ export const {{classname}}FetchParamCreator = function (configuration?: Configur localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; } {{/isOAuth}} - + {{#isBearer}} + // bearer token required + if (configuration && configuration.accessToken) { + const localVarAccessTokenValue = typeof configuration.accessToken === 'function' + ? configuration.accessToken("{{name}}") + : configuration.accessToken; + localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; + } + {{/isBearer}} {{/authMethods}} {{#queryParams}} {{#isListContainer}}