Skip to content

Commit 1b951ba

Browse files
nickvergessenbackportbot[bot]
authored andcommitted
Fix basic auth for OAuth token endpoint
Don't try to login when a client is trying to get a OAuth token. OAuth needs to support basic auth too, so the login is not valid inside Nextcloud and the Login exception would ruin it. Signed-off-by: Joas Schilling <coding@schilljs.com>
1 parent 74c2628 commit 1b951ba

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

lib/base.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -987,7 +987,13 @@ public static function handleRequest() {
987987
} else {
988988
// For guests: Load only filesystem and logging
989989
OC_App::loadApps(['filesystem', 'logging']);
990-
self::handleLogin($request);
990+
991+
// Don't try to login when a client is trying to get a OAuth token.
992+
// OAuth needs to support basic auth too, so the login is not valid
993+
// inside Nextcloud and the Login exception would ruin it.
994+
if ($request->getRawPathInfo() !== '/apps/oauth2/api/v1/token') {
995+
self::handleLogin($request);
996+
}
991997
}
992998
}
993999

0 commit comments

Comments
 (0)