PHP Hello Analytics Reporting API V4 with OAuth 2.0 - php

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.

Related

AWS Alexa skill linking with oauth 2

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

How to access Google Play Android Developer API through backend server

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.

Google Analytics API got me completely lost

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.

Localhost facebook login not working for lower level of the url

Thanks in advance for reading.
I've been working with facebook login (both php and javascript sdk methods) for a couple of years and I'm facing a particular problem with new apps I'm developing.
I have an app in my localhost configured as virtual directory as follows:
http://localhost/myapp/
On facebook, the following settings of my app are pointing to that url: App Domains, Facebook Login Website, App on Facebook (https and http) and Mobile Web.
When I do the login process and point the redirect_uri to http://localhost/myapp/, it works fine, the cookie is set and I can make queries to the graph api.
The problem comes when I try to use another redirect uri like http://localhost/myapp/user_controller/register (Adds the user to the database). Although it is inside the app url configured on facebook, the SDK outputs an error message (OAuthException | An active access token must be used to query information about the current user. | Code 2500).
I figured out that, to solve this problem for a while, I have to go to the facebook app page: apps.facebook.com/myapp. I have to do it everytime my access_token has expired and, since this app is not intended to be inside facebook, I don't think that this is the best way to solve this.
I hope together we can find a good way to solve this issue and this questions helps future developers.
I'm using CodeIgniter (which I've been using about a year) and Facebook PHP SDK (downloaded directly from the github official repo) as CI library.
Thanks again.
At no point would you get that error during authentication.
I'm pretty sure that you instead have an error in your code that fails to exchange the code for the access_token on the .../register endpoint, and so you end up using an invalid access_token.

Facebook app authentication

I made a fb PHP app sample and let my friend to use that. I expected him seeing an app authorization dialog. But The error message "An error occurred. Please try again later" message had been appeared instead.
We got same result even if we use a sample program in FB SDK for PHP.
He could use the app after I added him as a tester on the app's setting page on Facebook.
But he's got same error message after I removed him on the setting page.
I (administrator of the app on the Facebook app's setting) haven't seen error message on my app.
I have been searching for the solution. I have checked followings.
The App's settings; app ID, site URL, canvas URL and app Domain are supposed to be correct.(Otherwise I would not have used the app)
Sandbox mode is disabled.
Please suggest me to let him use the app without adding him on the settings page.
Am I missing something or doing something wrong?
Thanks in advance!
What hosting have you been using.. for your app and how do you know work out https url
I had the same issue when i tried using my app with facebook.com/socialserver for free https service, in that case i had tried my app first under me then completely under my friend administration and then again back to me .
Finally, i had to stop thinking about the free service and switch to the ads version of the service..

Categories