diff --git a/modules/openapi-generator/src/main/resources/typescript-nestjs/api.service.mustache b/modules/openapi-generator/src/main/resources/typescript-nestjs/api.service.mustache index 5c17513f994..4d2f116daf0 100644 --- a/modules/openapi-generator/src/main/resources/typescript-nestjs/api.service.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-nestjs/api.service.mustache @@ -142,6 +142,13 @@ export class {{classname}} { } {{/isBasicBasic}} +{{#isBasicBearer}} + if (typeof this.configuration.accessToken === 'function') { + headers['Authorization'] = `Bearer ${this.configuration.accessToken()}`; + } else if (this.configuration.accessToken) { + headers['Authorization'] = `Bearer ${this.configuration.accessToken}`; + } +{{/isBasicBearer}} {{#isOAuth}} if (this.configuration.accessToken) { const accessToken = typeof this.configuration.accessToken === 'function'