Skip to content

Commit

Permalink
feat: use strategy tokenName for requestWith (#301)
Browse files Browse the repository at this point in the history
Co-authored-by: @terion-name
Co-authored-by: @farnabaz
  • Loading branch information
pooya parsa committed May 23, 2019
1 parent aa5f29d commit 8654a48
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/core/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 8654a48

Please sign in to comment.