diff --git a/lib/base.php b/lib/base.php
index 1dd259b0914a0c92195f72400e433d927b2211f0..50b64c25cc5f57002c23c95a9ed52ac0680fdb34 100644
--- a/lib/base.php
+++ b/lib/base.php
@@ -760,6 +760,7 @@ class OC {
 		// Load minimum set of apps
 		if (!self::checkUpgrade(false)) {
 			// For logged-in users: Load everything
+			\OC_User::tryBasicAuthLogin();
 			if(OC_User::isLoggedIn()) {
 				OC_App::loadApps();
 			} else {
diff --git a/lib/private/user.php b/lib/private/user.php
index ff45e9e26a640a32c1513ad51fdfe03ce210e752..9a2ea3ef74f7af58595534d46f0dbe81d6e20303 100644
--- a/lib/private/user.php
+++ b/lib/private/user.php
@@ -319,6 +319,15 @@ class OC_User {
 		self::getUserSession()->logout();
 	}
 
+	/**
+	 * Tries to login the user with HTTP Basic Authentication
+	 */
+	public static function tryBasicAuthLogin() {
+		if(!empty($_SERVER['PHP_AUTH_USER']) && !empty($_SERVER['PHP_AUTH_USER'])) {
+			\OC_User::login($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']);
+		}
+	}
+
 	/**
 	 * Check if the user is logged in, considers also the HTTP basic credentials
 	 * @return bool
@@ -328,11 +337,6 @@ class OC_User {
 			return self::userExists(\OC::$server->getSession()->get('user_id'));
 		}
 
-		// Check whether the user has authenticated using Basic Authentication
-		if (isset($_SERVER['PHP_AUTH_USER']) && isset($_SERVER['PHP_AUTH_PW'])) {
-			return \OC_User::login($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']);
-		}
-
 		return false;
 	}