2

I want to run a daily cronjob to load data from Google Analytics into my database. I want to use PHP and oAuth 2.0.

I assume that this case would be considered a Web Server Application (https://developers.google.com/accounts/docs/OAuth2?hl=de#webserver)

But in all examples I find it uses the typical, a user clicks on a 'connect to Google' button, browser rediretcs to Google where the user has to login and authorize the request.

But I want to run this from the command line and the user is always me. I guess this is not very diferente from the browser approach but I am a little confused on where to start neither how to formulate this into a real question.

Does anyone have tutorials especificaly about this or any other help?

Thanks!

EDIT: The first time I have to get the token and the refresh token. Is there any other may to get this then over the google popup in the browser? Or do I have to make a little html page to run this once to get the token and refresh token? Still confused.

enter image description here

Linda Lawton - DaImTo
  • 106,405
  • 32
  • 180
  • 449
almo
  • 6,107
  • 6
  • 43
  • 86
  • 4. Refresh the access token, if necessary. Access tokens have limited lifetimes. If your application needs access to a Google API beyond the lifetime of a single access token, it can obtain a refresh token. A refresh token allows your application to obtain new access tokens. – cmorrissey May 14 '14 at 15:36
  • Are you only accessing your own GA Data? or data owned by other users? – Linda Lawton - DaImTo May 15 '14 at 12:46
  • http://stackoverflow.com/questions/9863509/service-applications-and-google-analytics-api-v3-server-to-server-oauth2-authen Check this solution – Arfeen Jun 02 '15 at 09:56

0 Answers0