From 8654a484231b603942508339ed949d4d8c610309 Mon Sep 17 00:00:00 2001 From: pooya parsa Date: Thu, 23 May 2019 23:10:13 +0430 Subject: [PATCH] feat: use strategy tokenName for `requestWith` (#301) Co-authored-by: @terion-name Co-authored-by: @farnabaz --- lib/core/auth.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/core/auth.js b/lib/core/auth.js index 3fc9a3160..7db9cf9cc 100644 --- a/lib/core/auth.js +++ b/lib/core/auth.js @@ -287,11 +287,12 @@ export default class Auth { const _endpoint = Object.assign({}, defaults, endpoint) + const tokenName = this.strategies[strategy].options.tokenName || 'Authorization' if (!_endpoint.headers) { _endpoint.headers = {} } - if (!_endpoint.headers['Authorization'] && isSet(token) && token) { - _endpoint.headers['Authorization'] = token + if (!_endpoint.headers[tokenName] && isSet(token) && token) { + _endpoint.headers[tokenName] = token } return this.request(_endpoint)