diff --git a/lib/Alchemy/Phrasea/Core/Provider/APIServiceProvider.php b/lib/Alchemy/Phrasea/Core/Provider/APIServiceProvider.php index a59752a439..0d77e9c26c 100644 --- a/lib/Alchemy/Phrasea/Core/Provider/APIServiceProvider.php +++ b/lib/Alchemy/Phrasea/Core/Provider/APIServiceProvider.php @@ -21,7 +21,7 @@ class APIServiceProvider implements ServiceProviderInterface public function register(Application $app) { $app['oauth2-server'] = $app->share(function ($app) { - return new \API_OAuth2_Adapter($app); + return new \API_OAuth2_Adapter($app, ['api_version' => $app['api.default_version']]); }); $app['token'] = $app->share(function (Application $app) { /** @var \API_OAuth2_Adapter $oauth2 */ diff --git a/lib/classes/API/OAuth2/Adapter.php b/lib/classes/API/OAuth2/Adapter.php index 925ba53ff4..c674aa277b 100644 --- a/lib/classes/API/OAuth2/Adapter.php +++ b/lib/classes/API/OAuth2/Adapter.php @@ -473,16 +473,16 @@ class API_OAuth2_Adapter extends OAuth2 * @param User $user * * @return mixed - * @throws logicalException + * @throws LogicException */ public function updateAccount(User $user) { if ($this->client === null) { - throw new logicalException("Client property must be set before update an account"); + throw new LogicException("Client property must be set before update an account"); } if (null === $account = $this->app['repo.api-accounts']->findByUserAndApplication($user, $this->client)) { - $account = $this->app['manipulator.api-account']->create($this->client, $user); + $account = $this->app['manipulator.api-account']->create($this->client, $user, $this->getVariable('api_version', V2::VERSION)); } return $account;