GAPI: Failed to authenticate user. Permanent fix P

2019-01-20 12:55发布

问题:

I am trying to fetch content from the GAPI it works sometimes but the other times it throws this error:

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

I browsed through all the answers but couldn't find a solution. I tried using both of these links previously:

https://accounts.google.com/DisplayUnlockCaptcha

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

It used to work but not anymore, can someone help?

回答1:

Failed to authenticate user

Means there is something wrong with your authentication.

GAPI hasn't been worked on since 2009. It also appears to use client login which was discontinued / shutdown on April 20 2015. You can no longer use client login with Google Analytics API, you need to switch to Oauth2 or a service account. So either the author of that project needs to fix his code, it appears to be an open source project so you could probably fix it for him.

In my opinion Google PHP client library probably a better solution.

tutorials:

  1. My Tutorial Google Analytics API php Oauth2
  2. My Tutorial Google Analytics api php service account
  3. Googles Tutorial embedded api