@d99999

Почему Google authentication API выдает ошибку Invalid state?

Использую knpu university bundle
/**
     * @Route("/connect-google", name="connect_google_start")
     * @param ClientRegistry $clientRegistry
     * @return Response
     */
    public function connectFacebookAction(ClientRegistry $clientRegistry): Response
    {
        return $clientRegistry
            ->getClient('google_main')
            ->redirect([
                'profile', 'email'
            ], []);
    }

    /**
     * @Route("/google-check", name="google_check")
     *
     * @param Request $request
     * @param ClientRegistry $clientRegistry
     * @return RedirectResponse
     */
    public function connectGoogleCheckAction(Request $request, ClientRegistry $clientRegistry)
    {
        $client = $clientRegistry->getClient('google_main');
        try {
            //be sure you use dev.pro VPN
            $user = $client->fetchUser();
            //В этом участке кода ошибка


            exit;

            $this->googleService->storeOrAuth($user, $request);
        } catch (IdentityProviderException $e) {
            $this->logger->error('Google authorization: ' . $e->getMessage());
        }

        return $this->redirectToRoute('home');
    }

603d4778f18bb345620998.png

Настройки
google_main:
            type: google
            client_id: '%env(OAUTH_GOOGLE_ID)%'
            client_secret: '%env(OAUTH_GOOGLE_SECRET)%'
            redirect_route: google_check
            redirect_params: {}
            access_type: 'offline'
  • Вопрос задан
  • 103 просмотра
Решения вопроса 1
@d99999 Автор вопроса
Нужно установить - не проверять state
Ответ написан
Комментировать
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы