Until recently we have been using the old gapi php class to extract Google Analytics data from a variety of sites that we manage.

In a nutshell at night the sites download the Analytics data and stores it locally. Until recently it worked beautifully but all of a sudden we started receiving all sorts of weird errors like CaptchaRequired.

Anyway I've done some reading and got the impression that it was time we move to the new Google APIs platform and while I have tried to follow the HelloAnalyticsAPI tutorial we initially got a 403 error but now after leaving it for a while when I try and run the app I get redirected to Google to login.

I just don't seem to be able to get my head around it. We need to completely automate this process so redirecting to login on the Google site isn't going to cut it.

Thanks atmon3r. It does look straight forward but the bit I'm struggling to "connect the dots" on is where or who should be issuing the client id for authentication. So let's say I have site www.example.com. This has Google Analytics on it linked to an account myemail@example.com. So our plugin that retreives the analytics data sits on www.example.com. So does the owner of the Analytics account need to login and create an oAuth client? And when creating the oAuth client should it be a "Service Application"? If you go with Web App then it will redirect as if in a browser????
–
JshsterPPAug 17 '12 at 2:15

Google sends Captcha responses if they are unsure about the authenticity of the request. This can be caused by multiple requests from the same IP for various different accounts, use of the ClientLogin authentication mechanism, and even weak passwords on the account you are logging in to.

To prevent them, I would recommend using OAuth 2.0 for the authentication - there are other security benefits to using this too.