From 899666b9b343b789b8da62a5e78b7fab60f4f4dd Mon Sep 17 00:00:00 2001 From: Dylan Bridgman Date: Thu, 18 May 2017 15:53:24 +0200 Subject: [PATCH] Always populate the authorization header unless explicitly undefined property is present --- src/interceptors/oauth-interceptor.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/interceptors/oauth-interceptor.js b/src/interceptors/oauth-interceptor.js index b94be80..f411396 100644 --- a/src/interceptors/oauth-interceptor.js +++ b/src/interceptors/oauth-interceptor.js @@ -9,7 +9,11 @@ function oauthInterceptor($q, $rootScope, OAuthToken) { config.headers = config.headers || {}; // Inject `Authorization` header. - if (!config.headers.hasOwnProperty('Authorization') && OAuthToken.getAuthorizationHeader()) { + if ( + ( + !config.headers.hasOwnProperty('Authorization') || typeof config.headers.Authorization !== 'undefined' + ) && OAuthToken.getAuthorizationHeader() + ) { config.headers.Authorization = OAuthToken.getAuthorizationHeader(); }