diff --git a/api/src/Security/ApiKeyAuthenticator.php b/api/src/Security/ApiKeyAuthenticator.php index a5c04a7f0..c4d0ce265 100644 --- a/api/src/Security/ApiKeyAuthenticator.php +++ b/api/src/Security/ApiKeyAuthenticator.php @@ -101,7 +101,7 @@ public function authenticate(Request $request): PassportInterface } // Set apiKey Application id in session - $this->session->set('apiKeyApplication', $application->getId()->toString()); + $this->session->set('application', $application->getId()->toString()); // Set organization id and user id in session $this->session->set('user', $user->getId()->toString()); diff --git a/api/src/Service/ApplicationService.php b/api/src/Service/ApplicationService.php index 6536ff90c..a83d16b70 100644 --- a/api/src/Service/ApplicationService.php +++ b/api/src/Service/ApplicationService.php @@ -44,15 +44,6 @@ public function getApplication(): Application } } - // If an api-key is used for authentication we already know which application is used - if ($this->session->has('apiKeyApplication')) { - $application = $this->entityManager->getRepository('App:Application')->findOneBy(['id' => $this->session->get('apiKeyApplication')]); - if ($application !== null) { - $this->session->set('application', $application->getId()->toString()); - return $application; - } - } - // Find application using the publicKey $public = ($this->request->headers->get('public') ?? $this->request->query->get('public')); if (empty($public) === false) {