GAPI:无法验证用户。永久修复 PHP

GAPI: Failed to authenticate user. Permanent fix PHP

我正在尝试从 GAPI 中获取内容,它有时可以正常工作,但有时会抛出此错误:

Exception GAPI: Failed to authenticate user. Error: "https://developers.google.com/accounts/docs/AuthForInstalledApps "

我浏览了所有答案,但找不到解决方案。 我之前尝试使用这两个链接:

https://accounts.google.com/DisplayUnlockCaptcha

https://www.google.com/settings/security/lesssecureapps

以前可以,但现在不行了,有人可以帮忙吗?

Failed to authenticate user

表示您的身份验证有问题。

GAPI hasn't been worked on since 2009. It also appears to use client login which was discontinued / shutdown on April 20 2015。您不能再使用 Google Analytics API 的客户端登录,您需要切换到 Oauth2 或服务帐户。因此,要么该项目的作者需要修复他的代码,它似乎是一个开源项目,因此您可能会为他修复它。

在我看来 Google PHP client library 可能是更好的解决方案。

教程

  1. 我的教程Google Analytics API php Oauth2
  2. 我的教程Google Analytics api php service account
  3. Google教程embedded api