Allow using bearer auth in typescript-nestjs (#17711)

Closes: #10114
This commit is contained in:
Simon Hanna 2024-02-02 15:23:20 +01:00 committed by GitHub
parent 8ff230ed06
commit 580da9978a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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'