php: Need explanation on creating a google calendar crawling cron job - php

In essence it seems like I don't understand the proper process of authenticating a cron service.
What I am trying to do:
I want to collect all events in a google calendar and store it in a mysql database. Sounds simple, but I've spent hours today trying to figure this out and have only gotten confused.
I've tried running
https://www.googleapis.com/calendar/v3/calendars/{CalendarId}/events?key={PublicAPIaccessKey}
hoping that it would work since the calendar is open to read access for everyone.
The response was
"Access Not Configured. Please use Google Developers Console to activate the API for your project."
So I went into Google Developer Console and enabled Google Calendar.
It still reports the same error.
Then I tried using the PHP library for Google OAuth (that is currently working for authenticating my users), but I don't have an access token and this is not a "client", but a "service" I am creating.
I have read up on Google Service Accounts. But I haven't found a resource that explains how I can use this account. It almost seemed as if I needed to set up billing and pay for using this account? Which is out of the question.
I am at a loss on how to proceed. I will continue to google and try to figure it out, but if someone can please explain this for me it would be greatly appreciated.

Try to follow the steps on service account creation here: https://developers.google.com/drive/web/delegation#create_the_service_account_and_its_credentials

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 get notification in website when any changes are made in Google Calendar?

I need to implement a concept in a php website, where I can sync my Google Calendar and later on when ever I make any changes in Google Calendar its changes should reflect to my website's calendar as well.
For that currently I have used Google's Calendar API. With the help of this I am able to connect my Google Calendar but not able to sync the Google calendar with my website when ever any change is made to Google Calendar. Can any one give me suggestions what can be done to achieve this.
I have tried even with the https://developers.google.com/google-apps/calendar/v3/push but with the given documentation could not get the notifications.
Any suggestions are welcome.
Thanks in advance !
Google calendar doesn't currently do push for web pages, only servers. You'll need to bring a server in the middle and forward the push to the browser when one arrives. I would recommend you look into http://en.wikipedia.org/wiki/Comet_(programming) and possibly also into alternatives described at the bottom.

Youtube Analytics PHP cron

I want to start developing a tool that runs daily via cron for getting daily analytical data from one channel, or video, etc.. through the "Youtube Analytics API". And not what is the best way to approach it.
I have read the documentation of Google and and I have several questions:
I created the project in the console (https://code.google.com/apis/console/) but I doubt what kind of application I have to choose when I create a Client ID (Web Application, Service Account or Installed aplplication).
What PHP library use?
It's a very new API and not much information.
In the Google GData site there is a warning about that "Most newer Google APIs Google Data APIs are not Google Data APIs." and in the google-api-php-client, no examples of this API.
What is the best method for authentication in a cron?
As you can see I am very confuse, can someone help me, please?
Thank you.
1) It will be an installed application unless you will run it in a web server.
2) Use the official library, add the ytanalytics php library. Samples: https://github.com/youtube/yt-samples-php
3) You can do so by getting a refresh token from OAuth2 Playground and setting it in your youtube object.
Here it explains a little more.
And a step by step video.

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.

Categories