After hours of work I am stuck with using google calendar php api, I need the basic functionality, reading and adding events (updating and removing later), any advice? I need the solution that works with the recent version of the api and is relatively simple.
Everything you need is well documented on Google Developers website. You will need composer to be running in your project and a Google Account.
On Google Developers page listed above, click Enable the Google Calendar API, select existing project or create a new one and click next. You will get your Client ID and unique Client Secret. You can manage this credentials in API Dashboard. Download these credentials.json and put them in your workdir.
Then you can setup composer for Google Client Library
composer require google/apiclient:^2.0
Now you can set up the sample. Create a file named quickstart.php and put there this code. You can run the sample using php quickstart.php.
Would you like to share your code with us, so we will be able to support you with more relevant answers?
Related
We have been developing a multi platform project which will eventually have an Android app, an iOS app and a web application. We are impressed with the features offered by Google Firebase therefore trying to leverage the opportunities.
Since our product is a multitenant software-as-a-service application we have custom authentication requirements. Therefore we followed the custom authentication implementation path of Firebase and it is functional now.
Our mobile clients send login requests to our API server,
Our API server issues customTokens and reponds them back to the clients,
Clients call signInWithCustomToken(customToken) method to sign in to Firebase.
So far so good.
What the issue is, our backend is in PHP and Firebase doesn't have an official Admin SDK for PHP. Yes, there is a package called kreait/firebase-php on Composer however it is far away from covering all of the Auth Admin SDK features. For example, there is a documented disable-user feature which is available on Firebase Admin SDK, however that operation is not implemented on the kreait/firebase-php package.
On the other hand Firebase has a Auth Rest API which just works with the API KEY. However, (I suppose ) it is designed to work on the client side therefore it just has operations for the authenticated user.
Our API server is already hosted on Google Compute Cloud and has the maximum set of access permissions on the Google Cloud services.
We have the Firebase service account file to work with the Firebase Auth services.
What we need is to consume all available Firebase Admin SDK features (possibly via Rest). For example, we would like to call revokeRefreshToken(uid) when a user changes his/her password on one of his/her devices.
Since at this specific issue there isn't any documentation, what would you advise us to do?
Update (25 January 2018)
The above mentioned missing endpoints on the Firebase unofficial PHP Admin SDK are now implemented by the maintainer after a productive discussion on a Github issue. However, I would like keep this question open since the nature of the question is asking for ideas for further collaboration and discussion.
Maintainer of said unofficial PHP SDK here :). You already have updated your original post to include that the SDK now supports the features that were missing.
I am posting this as a dedicated answer to be visible to people arriving here and searching for answers as well.
Although the Admin SDK for PHP is still not feature complete, we are getting there. I added feature matrix to the README of the Github project so that you can quickly see what is available and what isn't.
Going forward, I will implement new features by either implementing things similarly to the official Admin SDKs (especially https://github.com/firebase/firebase-admin-node) and by using the existing libraries provided by the Google Cloud Platform Library.
At some point in the future, Google will certainly provide all the necessary building blocks to use Firebase efficiently with PHP, but until then, I am happy about every happy PHP developer using my library :).
FYI: I just released a new version (4.1.0) which includes support for Firebase Cloud Storage and did in fact use the google/cloud-storage for that.
I think you can use the Identity Toolkit libraries provided by Google. Here's the one for PHP: https://github.com/google/identity-toolkit-php-client
I saw a post two days ago :
google api calendar php
And it looks like the code I need. I am only an amateur php programmer. I had been using Zend Framework to connect my website to a Google calendar to make changes on the calendar from my site,but now deprecated as it used V2 of Google API.
So now I am trying to use the PHP client library and have gone to the Google Developer console and created what I think is an 'App' (service account) to use the php client library. In the code in the above post there is a line:
$client->setApplicationName("My app");
I am not sure what that refers to? I have a 'project name' when creating it in the console but I am really not sure if this is the 'App name'. Or worse maybe i am not creating an app at all and have made a mistake. I have all the other parameters like client ID, key file and service account.
P.S. I saw one post where you had to add client ID to the ../src/Google/config.php file - is that needed as well?
thx
I found all the advice on setting up a service account and also the code for adding an event at daimto.com
App name can just be the project name form your Google console too BTW.
Hi I have a website that I am creating at the moment I have just created a dashboard for admin users I was wondering is there a way I can embed a Google analytic's dashboard or the elements of the dashboard into my own website.
My initial thought would be an i frame of the web page and then getting the user to sign in
I have looked at different questions surrounding this and people are being told to look at the Developer Guides and the implementing the API into their site, Can I do this ??
My website is PHP based with some HTML I am not sure if I am using a framework that the analytics can be implemented into because at the moment I'm currently using bootstrap for the admin dashboard the rest I have hand coded.
Any guides any examples of people doing this themselves that would be much appreciated.
I would recommend you look into using the Google Analtyics API with a service account. You will only be logging into your own data so there is no need to go though the full Oauth2.
The most current version of the Google PHP client lib can be found here on github under examples you want to look into the service-account.php it should show you how to get working with a service account.
Note: Unfortunately the hello analytics tutorial is out of date and uses the old client lib, don't go there. I have been told they are working on an update for it.
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.
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.