I'd like to pull in data from google analytics into an own database through an background cron job without the user having to authenticate every time.
I do know how to get an Google Analytics OAuth Access Token with user interaction as I asked previously. Using OAuth won't work, since it requires user interaction. According to Google Analytics API Reference OAuth as well as an Access Token can be used to access the stats of an page once on a per session base. However I'm looking for an persistent way to implement this in an background service.
How can I access google analytics without user authentication or get an none expireing access token?
Assuming the account in question is your own you can us a service account. Make sure that you give the service account email address read access at the Account level to the Google analytics account and it will be able to read your data.
code ripped from tutorial Google Service Account with PHP
If this is not your account then you can use the normal Oauth2 method ask the use to authenticate you once then using the refresh token you will be able to access the data. Using the code from your previous question.