(403) Legacy People API > 之前未在项目 XXXXXXXX 中使用过或者在 Codeigniter 中被禁用
P粉201448898
P粉201448898 2023-08-25 22:54:55
0
1
554
<p>我正在使用 Google 登录,几个月前它可以正常工作,但现在当我尝试登录时,它会出现以下错误:</p> <blockquote> <p>遇到未捕获的异常类型:Google_Service_Exception</p> <p>消息:调用 GET 时出错 https://www.googleapis.com/plus/v1/people/me:(403) 旧版 People API 之前未在项目 XXXXXXXX 中使用过或已禁用。使能够 通过访问它 https://console.developers.google.com/apis/api/legacypeople.googleapis.com/overview?project=XXXXXXXX 然后重试。如果您最近启用了此 API,请等待几分钟 传播到我们的系统并重试的操作。</p> </blockquote> <p>访问它显示的链接</p> <pre class="brush:php;toolbar:false;">"Failed to load." "There was an error while loading /apis/.....googleapis.com/overview?project=<project_id>. Please try again."</pre> <p>我也启用了 <code>People API</code></p> <p>但仍然收到相同的错误消息</p> <p>我已启用 API:</p> <p>请提供任何解决方案,谢谢</p> <p>代码:</p> <pre class="brush:php;toolbar:false;"><?php require_once('Google/autoload.php'); class Google { protected $CI; public function __construct($url){ $this->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; } } }</前> <块引用> <p>GoogleConfig.php</p> </块引用>
$config['google_client_id']=“XXXXX.apps.googleusercontent.com”;
$config['google_client_secret']=“XXXX”;</pre>
<p>控制器:</p>
$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();</pre>
<p>查看:</p>
P粉201448898
P粉201448898

全部回复(1)
P粉790819727

API 已禁用。

此错误消息是由于 Google Cloud Console 上的项目未启用此 api 造成的一个> .

为什么不启用它是一个我无法回答的问题。

要修复此问题,请转到库下的 Google Cloud Console

搜索人员 API

点击它

然后单击启用按钮,我的显示管理,因为它已经启用。

加载失败

加载失败错误可能意味着两件事。

  1. 有人删除了您在您正在使用的 Google Cloud Console 上使用的项目运行此应用程序。
  2. 有人删除了您对 Google Cloud Console 上的项目的访问权限找出管理员是谁并让他们修复上面的错误。

着火

错误消息让我有点困惑。这似乎暗示您正在使用此端点 https://www.googleapis.com/plus /v1/people/me。我认为所有的 google plus api 端点几年前都被重命名为 people api。您应该使用 people.get 这让我想知道是否谷歌刚刚禁用了您仍在使用的某些东西。

范围

请尝试从您的应用中删除这些范围

它们是旧的 google plus 范围,现在不存在。个人资料和电子邮件应该足够了。

热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责声明 Sitemap
PHP中文网:公益在线PHP培训,帮助PHP学习者快速成长!