customerTokenService = $customerTokenService; } /** * @inheritdoc */ public function resolve( Field $field, $context, ResolveInfo $info, array $value = null, array $args = null ) { if (!isset($args['email'])) { throw new GraphQlInputException(__('Specify the "email" value.')); } if (!isset($args['password'])) { throw new GraphQlInputException(__('Specify the "password" value.')); } try { $token = $this->customerTokenService->createCustomerAccessToken($args['email'], $args['password']); return ['token' => $token]; } catch (AuthenticationException $e) { throw new GraphQlAuthenticationException(__($e->getMessage()), $e); } } }