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.
Can anyone help? Anyone seen these issues?
Use google api client for php, it's easy
http://code.google.com/p/google-api-php-client/
And dev guide for analytics (V3):
https://developers.google.com/analytics/devguides/config/mgmt/v3/
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.
Related
Hello to all
I am new in Amazon Alexa, I have a work to Alexa Skill account linking using PHP with oauth 2.0.
I have successfully configured all and also get code for Auth Code Grant but when I run my code in Chrome Browser it is generating Account linking Failed issue but when I run same URL in Firefox it generates Amazon linking failed with ERROR=missing-state.
Please help me to resolve my issue, any help would be highly appreciated.
Implementing Account Linking is tricky at times. The thing is at some point what happens between Alexa and the OAuth2 server is transparent for the Skill (Lambda), for example the process of refreshing a token among others, that is why I suggest you take a look at the references cited below.
Also because of the error shown, it seems that the parameter code is missing in one of the URLs exchanged back and forth between either the Alexa web console or Alexa mobile app and the OAuth2 server. Please verify it is always the same and is always present in the URLs. Implementing a proxy for sure will help on debugging this issue.
I would suggest you take a look at these great sources:
Debugging Account Linking
Using API Gateway to Debug Account Linking issues
I hope this helps somehow.
Cheers
I am trying to access the Google Analytics API for web applications using PHP, like described in this tutorial: https://developers.google.com/analytics/devguides/reporting/core/v4/quickstart/web-php
I have followed all the steps precisely, however was not been able to make it running. I have managed to debug so far that I found out about where the problem is.
When OAuth consent screen pops up and I click Allow, application does not get authorized. I just keep seeing the same popup. Also, if I check authorized apps in my google account, it is not listed there.
Another interesting fact is that Hello Analytics Reporting API V4 using JavaScript is working just fine.
https://developers.google.com/analytics/devguides/reporting/core/v4/quickstart/web-js
Does anybody have a clue about what could be wrong with my app authorization?
OK, now I have additionally discovered it has something to do with localhost. Once I have uploaded the same code to live server, it is working just fine. But I cannot get it working on locahost. Does anybody have an idea how to setup Credentials or whatever to make it working in development environment (localhost)?
Check your browser extensions (i.e. Disconnect) may be blocking the auth token.
I recently completed my first API in PHP. It is hosted at a public URL and accessed by a couple of my own mobile apps and websites. Based on a couple of parameters passed in, it pulls some data from my database and returns some JSON.
I would like to know some details about how often the API is accessed, and by what kind of clients.
Can I use google analytics for this? I have used it successfully on some websites in the same domain, but when I include the analytics php link and access the API, nothing is recorded.
Any gotchas I could be missing? Or is Google analytics only useable on web pages?
Google analytics isnt just for montiring websites, you can also use it to monitor mobile applications.
You might be able to monitor your API with the Measurement Protocol this should let you send info about the preformance of your api, and log the things you are talking about.
Note: I havent tried it but would love to hear from you if this works.
I am implemented In App Billing for android.I wanted to implement subscription validity checking through my backend server. As Google Play Documentation, for making call for Google Play API,need authentication using oauth 2.0.
I followed instructions for registering project and creating credentials. But from there I have no idea how to use those credentials, I tried authentication via CURL request, but it asking permission as shown in follwing image
This permissions works fine I can exchange code and get access token, but all this done by manually, how should I implement this on backend.
I even try to use google api php library provided by Google, but It adds confusion. Also they didn't provide any example, how to use library.
Can anybody elaborate how exactly use library or pure php?
Thanks in advance.
To perform LVL and/or IAB validation on a server, do not access Google servers directly from the server. Even if all information were available, you would face integrity problems, because your app and your server will see different information due to synchronization latencies.
Instead, use your app as a proxy and validate the Google Play information on your server as described here.
I'm very new to web development. I have searched for login with Google plus and found several good tutorials. But they seems to be very old (most of them from 2011). Why?
I tried below code chunks.
<script type="text/javascript" language="javascript">
$("#packagesGrid").load('https://www.googleapis.com/oauth2/v1/userinfo?alt=json&access_token=ya29.ahes6zt9yv2qaeej5ycn21fn9maokp15scwqkcal3guqxxez7odtjg&token_type=bearer&expires_in=3600');
</script>
I just manually copy pasted the token to the url on the jQuery load function. But nothing is filled to the page.
Google APIs use the OAuth 2.0 protocol for authentication and authorization. Google supports several OAuth 2.0 flows that cover common web server, JavaScript, device, installed application, and server to server scenarios. The Previous Versions of OAuth has been deprecated by Google.
Here is how it works : https://developers.google.com/accounts/docs/OAuth2
To Get Started with Coding,
https://code.google.com/p/google-plus-php-starter/
Just download the project and Follow the steps mentioned.
I have tried this recently and it's working 100% fine.
I'm in a Google presentation at the moment and apparently they have just launched Google+ sign-in, which allows you to do stuff like this much more elegantly.
I don't know any more about it than that, really, but it certainly seems worth a look.
I would suggest making use of the following tutorial Login with Google Account OAuth. It explains calling the correct methods and saves the user data to your database. Plus it was published today.
For this you have to use google client Api library for php
and after that, you need to generate some key (like client id, client secret key, simple API key for Google)
then you have to use these API and use the keys generated. You can find the complete procedure and documents at there corresponding websites...
If you neeed the working tutorial.