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.