diff --git a/app/init.php b/app/init.php index 292c54bb35..eb664f9b55 100644 --- a/app/init.php +++ b/app/init.php @@ -872,7 +872,8 @@ App::setResource('user', function ($mode, $project, $console, $request, $respons } } - $authJWT = $request->getParam('jwt', $request->getHeader('x-appwrite-jwt', ''));; + $authJWT = $request->getParam('jwt', $request->getHeader('x-appwrite-jwt', '')); + ; if (!empty($authJWT) && !$project->isEmpty()) { // JWT authentication $jwt = new JWT(App::getEnv('_APP_OPENSSL_KEY_V1'), 'HS256', 900, 10); // Instantiate with key, algo, maxAge and leeway. diff --git a/tests/e2e/Services/Account/AccountCustomClientTest.php b/tests/e2e/Services/Account/AccountCustomClientTest.php index 6f75a998c1..ebe917e513 100644 --- a/tests/e2e/Services/Account/AccountCustomClientTest.php +++ b/tests/e2e/Services/Account/AccountCustomClientTest.php @@ -328,6 +328,15 @@ class AccountCustomClientTest extends Scope $this->assertEquals($response['headers']['status-code'], 200); + // JWT as request param + $response = $this->client->call(Client::METHOD_GET, '/account?jwt=' . $jwt, array_merge([ + 'origin' => 'http://localhost', + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ])); + + $this->assertEquals($response['headers']['status-code'], 200); + $response = $this->client->call(Client::METHOD_DELETE, '/account/sessions/' . $sessionId, array_merge([ 'origin' => 'http://localhost', 'content-type' => 'application/json',