diff --git a/core/modules/server/authenticators/header.js b/core/modules/server/authenticators/header.js index 9d9990d31..cc1d6bdaf 100644 --- a/core/modules/server/authenticators/header.js +++ b/core/modules/server/authenticators/header.js @@ -37,7 +37,9 @@ HeaderAuthenticator.prototype.authenticateRequest = function(request,response,st return false; } else { // authenticatedUsername will be undefined for anonymous users - state.authenticatedUsername = $tw.utils.decodeURIComponentSafe(username); + if(username) { + state.authenticatedUsername = $tw.utils.decodeURIComponentSafe(username); + } return true; } };