diff --git a/lib/auth/auth.js b/lib/auth/auth.js index 60d4d26f6..69fd1c1e9 100644 --- a/lib/auth/auth.js +++ b/lib/auth/auth.js @@ -1,7 +1,7 @@ import getProp from 'dotprop' import Storage from './storage' -import { routeOption, isRelativeURL, isUnset, isSameURL } from './utilities' +import { routeOption, isRelativeURL, isSet, isSameURL } from './utilities' export default class Auth { constructor (ctx, options) { @@ -237,17 +237,13 @@ export default class Auth { requestWith (strategy, endpoint, defaults) { const token = this.getToken(strategy) - if (isUnset(token)) { - return Promise.reject(new Error('No Token')) - } - const _endpoint = Object.assign({}, defaults, endpoint) if (!_endpoint.headers) { _endpoint.headers = {} } - if (!_endpoint.headers['Authorization']) { + if (!_endpoint.headers['Authorization'] && isSet(token)) { _endpoint.headers['Authorization'] = token }