diff --git a/lib/base.php b/lib/base.php
index 50b64c25cc5f57002c23c95a9ed52ac0680fdb34..ae87ecff3947da3e24ae94fdfab3cb9aa2725751 100644
--- a/lib/base.php
+++ b/lib/base.php
@@ -760,13 +760,13 @@ 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 {
 				// For guests: Load only authentication, filesystem and logging
 				OC_App::loadApps(array('authentication'));
 				OC_App::loadApps(array('filesystem', 'logging'));
+				\OC_User::tryBasicAuthLogin();
 			}
 		}