diff --git a/app/code/Magento/CustomerGraphQl/Model/Resolver/Customer/Account/GenerateCustomerToken.php b/app/code/Magento/CustomerGraphQl/Model/Resolver/Customer/Account/GenerateCustomerToken.php index 8737e09e08545..d20f020834885 100644 --- a/app/code/Magento/CustomerGraphQl/Model/Resolver/Customer/Account/GenerateCustomerToken.php +++ b/app/code/Magento/CustomerGraphQl/Model/Resolver/Customer/Account/GenerateCustomerToken.php @@ -52,13 +52,10 @@ public function resolve( ResolveInfo $info, array $value = null, array $args = null - ): Value { + ) { try { $token = $this->customerTokenService->createCustomerAccessToken($args['email'], $args['password']); - $result = function () use ($token) { - return !empty($token) ? ['token' => $token] : ''; - }; - return $this->valueFactory->create($result); + return !empty($token) ? ['token' => $token] : ''; } catch (AuthenticationException $e) { throw new GraphQlAuthorizationException( __($e->getMessage())