File tree Expand file tree Collapse file tree
modules/openapi-generator/src/main/resources/typescript-fetch Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -107,10 +107,21 @@ export class {{classname}} extends runtime.BaseAPI {
107107 { {/headerParams} }
108108 { {#authMethods} }
109109 { {#isBasic} }
110+ { {#isBasicBasic} }
110111 if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) {
111112 headerParameters[" Authorization" ] = " Basic " + btoa(this.configuration.username + " :" + this.configuration.password);
112113 }
114+ { {/isBasicBasic} }
115+ { {#isBasicBearer} }
116+ if (this.configuration && (this.configuration.accessToken || this.configuration.apiKey)) {
117+ const token = this.configuration.accessToken || this.configuration.apiKey;
118+ const tokenString = typeof token === ' function' ? token(" {{name}}" , [{{#scopes} }"{ {{scope} }}"{ {^-last} }, { {/-last} }{ {/scopes} }]) : token;
113119
120+ if (tokenString) {
121+ headerParameters[" Authorization" ] = `Bearer ${tokenString} `;
122+ }
123+ }
124+ { {/isBasicBearer} }
114125 { {/isBasic} }
115126 { {#isApiKey} }
116127 { {#isKeyInHeader} }
You can’t perform that action at this time.
0 commit comments