(403) Legacy People API > has not been used before in project XXXXXXXX or is disabled in Codeigniter
P粉201448898
P粉201448898 2023-08-25 22:54:55
0
1
489

I'm using Google login and it was working fine a few months ago, but now when I try to log in it gives the following error:

Uncaught exception type encountered: Google_Service_Exception

Message: Error while calling GET https://www.googleapis.com/plus/v1/people/me: (403) Old version of People API Not previously used in project XXXXXXXX or disabled. enable access it via https://console.developers.google.com/apis/api/legacypeople.googleapis.com/overview?project=XXXXXXXX Then try again. If you recently enabled this API, please wait a few minutes propagate to our system and retry the operation.

Visit the link it displays

"Failed to load." "There was an error while loading /apis/....googleapis.com/overview?project=. Please try again."

I also enabled the People API

But still getting the same error message

I have enabled the API:

Please provide any solution, thank you

Code:

CI =& get_instance(); $this->CI->load->library('session'); $this->CI->config->load('google_config'); $this->client = new Google_Client(); $this->client->setClientId($this->CI->config->item('google_client_id')); $this->client->setClientSecret($this->CI->config->item('google_client_secret')); $this->client->setRedirectUri($url[0]); $this->client->setScopes(array( "https://www.googleapis.com/auth/plus.login", "https://www.googleapis.com/auth/plus.me", "https://www.googleapis.com/auth/userinfo.email", "https://www.googleapis.com/auth/userinfo.profile" ) ); } public function get_login_url(){ return $this->client->createAuthUrl(); } public function validate(){ if (isset($_GET['code'])) { $this->client->authenticate($_GET['code']); $_SESSION['access_token'] = $this->client->getAccessToken(); } if (isset($_SESSION['access_token']) && $_SESSION['access_token']) { $this->client->setAccessToken($_SESSION['access_token']); $plus = new Google_Service_Plus($this->client); $person = $plus->people->get('me'); $info['id']=$person['id']; $info['email']=$person['emails'][0]['value']; $info['name']=$person['displayName']; $info['link']=$person['url']; $info['profile_pic']=substr($person['image']['url'],0,strpos($person['image']['url'],"?sz=50")) . '?sz=800'; return $info; } } }

GoogleConfig.php

$config['google_client_id']="XXXXX.apps.googleusercontent.com"; $config['google_client_secret']="XXXX";

控制器:

$this->load->library('google',array(base_url().$this->config->item('google_redirect_url_signin'))); $this->data['google_redirect_url_signin']=$this->google->get_login_url();

查看:

P粉201448898
P粉201448898

reply all (1)
P粉790819727

API is disabled.

This error message is due toGoogle Cloud Console 上的项目未启用此 api 造成的一个> .

Why it's not enabled is a question I can't answer.

To fix this issue, go toGoogle Cloud Console

under Libraries

Search Personnel API

click it

Then click the Enable button to show my management as it is already enabled.

Failed to load

Load failed errors can mean two things.

  1. Someone deleted the project you were using on theGoogle Cloud Consoleyou are using to run this application.
  2. Someone removed your access to a project onGoogle Cloud ConsoleFind out who the administrator is and have them fix the error above.

on fire

The error message confuses me a bit. This seems to imply that you are using this endpointhttps://www.googleapis.com/plus /v1/people/me. I think all the google plus api endpoints were renamed to people api a few years ago. You should usepeople.getThis makes me wonder if Google just disabled something you are still using.

scope

Please try removing these scopes from your app

They are old google plus scopes that don't exist now. Personal details and email should be enough.

    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template
    About us Disclaimer Sitemap
    php.cn:Public welfare online PHP training,Help PHP learners grow quickly!