Allow auth.accessToken to be either function or string (#7484)

This commit is contained in:
Jakub Surdej
2020-09-29 10:56:38 +02:00
committed by GitHub
parent 3f18d0fd10
commit 2d30714d5e
4 changed files with 16 additions and 4 deletions

View File

@@ -302,7 +302,10 @@ class ApiClient {
break;
case 'bearer':
if (auth.accessToken) {
request.set({'Authorization': 'Bearer ' + auth.accessToken});
var localVarBearerToken = typeof auth.accessToken === 'function'
? auth.accessToken()
: auth.accessToken
request.set({'Authorization': 'Bearer ' + localVarBearerToken});
}
break;