From e0443b1a4841ebdc239d94f47f4e190a79ea7d44 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Fri, 3 Jul 2020 10:55:12 +0300 Subject: [PATCH] Fixed OAuth2 tests --- app/app.php | 2 +- app/controllers/api/account.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/app.php b/app/app.php index 6028d6967..186ffd8cc 100644 --- a/app/app.php +++ b/app/app.php @@ -242,7 +242,7 @@ App::init(function ($utopia, $request, $response, $console, $project, $user, $lo $usage ->setParam('projectId', $project->getId()) - ->setParam('url', $request->getServer('HTTP_HOST', '').$request->getServer('REQUEST_URI', '')) + ->setParam('url', $request->getHostname().$request->getServer('REQUEST_URI', '')) ->setParam('method', $request->getMethod()) ->setParam('request', 0) ->setParam('response', 0) diff --git a/app/controllers/api/account.php b/app/controllers/api/account.php index 906d3048d..272656cf2 100644 --- a/app/controllers/api/account.php +++ b/app/controllers/api/account.php @@ -365,7 +365,7 @@ App::get('/v1/account/sessions/oauth2/:provider/redirect') /** @var Appwrite\Event\Event $audit */ $protocol = $request->getProtocol(); - $callback = $protocol.'://'.$request->getServer('HTTP_HOST').'/v1/account/sessions/oauth2/callback/'.$provider.'/'.$project->getId(); + $callback = $protocol.'://'.$request->getHostname().'/v1/account/sessions/oauth2/callback/'.$provider.'/'.$project->getId(); $defaultState = ['success' => $project->getAttribute('url', ''), 'failure' => '']; $validateURL = new URL();