]> source.dussan.org Git - nextcloud-server.git/commitdiff
Fix basic auth for OAuth token endpoint 29341/head
authorJoas Schilling <coding@schilljs.com>
Tue, 19 Oct 2021 11:03:23 +0000 (13:03 +0200)
committerMichaIng <micha@dietpi.com>
Sat, 30 Oct 2021 00:25:06 +0000 (02:25 +0200)
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>
lib/base.php

index 473a3419cb1436d57319f679c1b29937ab8f2732..2e6e2a65d80fc75e2a329734cbac474ca5c0c4bc 100644 (file)
@@ -987,7 +987,13 @@ class OC {
                        } else {
                                // For guests: Load only filesystem and logging
                                OC_App::loadApps(['filesystem', 'logging']);
-                               self::handleLogin($request);
+
+                               // 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.
+                               if ($request->getRawPathInfo() !== '/apps/oauth2/api/v1/token') {
+                                       self::handleLogin($request);
+                               }
                        }
                }