Google OAuth 2.0 возвращает 400 «Bad Request» даже с игровой площадки

Я пытаюсь использовать клиентскую библиотеку PHP League OAuth2 для проверки подлинности в приложении CodeIgniter. Тем не менее, я всегда получаю ошибку 400 «Плохой запрос». Поэтому я попытался использовать свой собственный идентификатор клиента и клиентскую секретность на игровой площадке OAuth 2.0 Google, и это дает ту же ошибку. Интересно, что Сообщество Jasper Reports получает ту же ошибку, когда я пытаюсь войти в свой аккаунт Google. Вернувшись на площадку, я пробовал логин Google Plus, а также старую конечную точку. У Google произошел сбой?

Неверный URL-адрес

https://accounts.google.com/o/oauth2/auth? client_id=xxxxx-xxxxx.apps.googleusercontent.com &redirect_uri=mywebsite.com%2Fauth%2Fsession%2Fgoogle &state=yyyyyzzzzzwwwww &scope=profile &response_type=code &approval_prompt=auto 

(Состояние переменных, redirect_uri и т. Д. Скрыты для обеспечения безопасности). Вот мой код контроллера, основанный на примере Фила Стерджона:

 class Auth extends CI_Controller { public function __construct() { parent::__construct(); log_message('debug', 'Auth: controller loaded.'); } public function session($provider_name) { $this->load->helper('url_helper'); switch (strtolower($provider_name)) { case "eventbrite": $provider_name = 'Eventbrite'; break; case "facebook": $provider_name = 'Facebook'; break; case "github": $provider_name = 'Github'; break; case "google": $provider_name = 'Google'; break; case "instagram": $provider_name = 'Instagram'; break; case "linkedin": $provider_name = 'LinkedIn'; break; case "microsoft": $provider_name = 'Microsoft'; break; case "vkontakte": $provider_name = 'Vkontakte'; break; } log_message('debug', 'Auth: session to ' . $provider_name); $class = 'League\\OAuth2\\Client\\Provider\\'.$provider_name; $provider = new $class(array( 'clientId' => $this->config->item('client_id'), 'clientSecret' => $this->config->item('client_secret'), 'redirectUri' => $this->config->item('redirect_uri') )); log_message('debug', 'Auth: connect ' . $this->config->item('client_id')); if (! $this->input->get('code')) { // By sending no options it'll come back here $url = $provider->getAuthorizationUrl(); log_message('error', 'Auth: redirect to ' . $url); redirect($url); } else { // Have a go at creating an access token from the code // Try to get an access token (using the authorization code grant) $token = new stdClass(); // If you are using Eventbrite you will need to add the grant_type parameter (see below) if ($provider_name == 'eventbrite') { $token = $provider->getAccessToken('authorization_code', [ 'code' => $_GET['code'], 'grant_type' => 'authorization_code' ]); } else { $token = $provider->getAccessToken('authorization_code', [ 'code' => $_GET['code'] ]); } // Use this object to try and get some user details (username, full name, etc) try { // We got an access token, let's now get the user's details $userDetails = $provider->getUserDetails($token); // Use these details to create a new profile //printf('Hello %s!', $userDetails->firstName); } catch (Exception $e) { // Failed to get user details show_error("That didn't work: " . $e); log_message('error', "Auth: That didn't work: " . $e); } // Here you should use this information to A) look for a user B) help a new user sign up with existing data. // If you store it all in a cookie and redirect to a registration page this is crazy-simple. echo "<pre>Tokens: "; var_dump($token); echo "\n\nUser Info: "; var_dump($userDetails); } } }