aboutsummaryrefslogtreecommitdiffstats
path: root/lib/base.php
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2021-10-19 13:03:23 +0200
committerJoas Schilling <coding@schilljs.com>2021-10-19 13:03:23 +0200
commit03936d776272e5bd270fb185ad7bcb438cc635d7 (patch)
tree05e4421a0db3722161d3cbd6c5cfd73a68c5cbc4 /lib/base.php
parentf7b3d521f866a949f457f31f8f8480aebd3c9934 (diff)
downloadnextcloud-server-03936d776272e5bd270fb185ad7bcb438cc635d7.tar.gz
nextcloud-server-03936d776272e5bd270fb185ad7bcb438cc635d7.zip
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>
Diffstat (limited to 'lib/base.php')
-rw-r--r--lib/base.php8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/base.php b/lib/base.php
index 94610576fce..78dba4f835e 100644
--- a/lib/base.php
+++ b/lib/base.php
@@ -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);
+ }
}
}