I'm using Mobirise to build our club's website, and they want to show some of our events at the top of the page.
I thought I could make something like this, with the outer blue being where the calendar frame would end (very rough drawing, don't judge too hard).
Tockify had something pretty close, but I figured there's a way to code something like this, or perhaps another service that's free that can do this. I would prefer not to use PHP, but embed some JavaScript into the HTML that can do this.
Thanks!
To retrieve events from an account's calendar, you need to connect to the Google Calendar API using authorized credentials.
For this you need to create a project in Google Cloud Platform, and enable the calendar API for that project. You will also need to create credentials for your app to use when making calls to the API.
After you have a project, credentials and you have enabled the Calendar API, it is time to code a script that uses the credentials to get the data you want from the Calendar API.
There are several language client libraries for each developer's need. You could use JavaScript for your application.
Here is a quickstart that should get you up and running to make those Calendar API calls you are looking for.
Calendar API Quickstart
Related
I'm trying to develop a react native application that won't require a user to sign into a bunch of different services every time. For now I'm trying to get the google side of things setup where a user can click a button which will allow me to link my application to there Google user account so that when they next visit the app the don't need to log into google for the functionality to continue to work.
I'm having a hard time finding documentation about how this link can be set up but I have found this page on Google which suggests it's possible.
https://myaccount.google.com/accountlinking?hl=en-GB&pli=1
The idea would be a bit like last.fm handles Spotify. a simple login and approve the service will mean that last.fm can listen to the Spotify account without requiring further auth every time its doing said functionality.
I can't find much in terms of tutorials or documentation on this specific thing.
Google OAuth and Scopes
It sounds like you're looking to implement Google identity federation in your app - specifically, OAuth 2.0. Google gives you quite a few options depending on the complexity of your authenticated user experience.
As for permissions, the Google API documentation calls these scopes. Here's a list of all the available scopes for every Google API. Setting scopes can take a few additional steps depending on which Google apps/information your app needs access to. By default, the Google API scopes for a new project are email, profile, and openid. Here's a video explaining how to view and modify the scopes in the Google API console(mentioned below).
1. Google Sign-in Button with scopes
The simplest method would be to follow this guide from Google which explains how to set up Google Auth on the frontend.
In short, you first set up a project within the Google API Console. Create a new project and take a look at your project scopes by clicking the Credentials tab, then the OAuth Consent Screen tab. Then back in your frontend code, include a script tag to call the Google API related to authentication functionality. Next, include a meta tag containing the client key found in the Google API Console. Then just create a sign in button with a certain class and data attribute(mentioned in the guide) and users should be able to sign in. This will return a small amount of user data in your code which you can use for validation within your app.
2. Firebase with scopes
A more complex solution would be Firebase authentication which returns even more user data, the use of a database to save and retrieve data related to the user and their session, and many other handy features that would normally be time consuming to develop. As such, Firebase is often called a backend as a service(BaaS).
To get the same level of granularity of scopes as the standard OAuth scenario outlined above, you may need to use a combination of the two as described in this article from Fireship.io.
I'm having some difficulties in figuring out the best way to do this:
Using Google Analytics API, or similar Google API, I would like to track a user's activity from the moment they access the page until they reach an end page, which is gonna show them back some charts with THEIR activity on my website. (Nothing too detailed, just how long they've been on each page, how many session etc.)
So far, I've managed follow the Embed API example to access THE USER's Google Analytics account and draw a chart by asking for permission, however when it comes to showing data from MY account I just can't seem to figure it out.
I want my website to automatically use my account (or service account) and draw some charts from my google analytics data and show it to every user.
What would be the best way to approach this? I've read something about access tokens but I don't know if that's the solution. Moreover, my hosting is a shared host and I don't think it allows installing Python Modules like in this example.
Cheers for the help!
If you want to show the user your data, you will have to perform the authentication on the server side. There is no way around this. It is after all, your account's data that they are accessing.
If you are unable to install Google's client library, you need to:
Get an access token using cURL (see how here)
Use that access token to perform server side authentication for the user (see how here)
The user should now be able to access your site without logging in, and see YOUR data.
I am building a web page for bookings.
This page needs to check one of my public agendas to see if a trailer is available:
Example event
I want to use the google calendar API for this purpose, the API needs to give me a list of the dates in the google calendar. For this purpose I made a page based on the google calendar API javascript quickstart.
The only problem is that it loads the calendar of the current user (for example freddi#gmail.com) but I want it to open my calendar (thomas.leflere#gmail.com). How do I modify the google API calendar javascript quickstart code to achieve this goal?
Google Calendar API Javascript quickstart
The references you've seen involve non-REST APIs. Getting this programatically is possible using a service account. Details on how to create a service account are on Google's page about two-legged OAuth, a snippet is
Typically, an application uses a service account when the application
uses Google APIs to work with its own data rather than a user's data.
For example, an application that uses Google Cloud Datastore for data
persistence would use a service account to authenticate its calls to
the Google Cloud Datastore API.
Since this method involves putting a private key on machine initiating the API call, it seems that doing it directly from the browser in JavaScript is not going to be viable. An intermediate server would be needed.
The better alternative for JavaScript would be to invoke an Ajax REST API of a public calendar which is now in version 3. You can find documentation on the API at https://developers.google.com/google-apps/calendar/v3/reference/
I'm very new to Ruby on Rails and I was wondering how I would go about implementing a calendar on my web app that a user could sync with their own google calendar, so that it would show their events. Ideally they would be able to add events to this calendar too, which would update their google calendar. I just don't know how I would start this. I know that there are insert and get methods provided by the gem, but I don't know where I would be calling them?
At the moment I have a User model (+controller) and a sessions controller, with a few views for the website. Would I need to create another model 'Calendar and a controller for that? Would calendar events also be another model or should they be handled within the calendar class? Would the google client api gem methods be used in the sessions controller or the calendar controller?
I haven't made my calendar yet, but I want to do it using javascript. Could any of you recommend any pre-made javascript calendars?
Thanks in advance and sorry for all the questions, I'm just trying to get my head round this!
You're doing too much at once. Specifically you want to:
Create, Update, Read & Delete calendar events (on your server, in your database)
Consume a google API to synchronise your copy of the user's calendar with google
Add some javascript whizzbang to make it all snappy and buzzword-compliant.
That's too much too start. Focus on doing these three things sequentially. Start with a rails app that has the following models: User, Calendar, Event and allows users to edit their calendars.
Don't start thinking about google until you get that first version working.
I'm looking to create a read-only calendar on my website based on a users calendar (google, outlook, iCal, etc). In order to do this, I figured I would need to make a call to get/create an ics file. Is this possible to do in javascript/jquery? Thanks
If you want to create files on your own server, you'll need server-side code to do this. If you'd like to get files from your own server, you can use JavaScript, though if you'd like to get files from other servers, you'll need to use JSONP or CORS.
Another possible solution is to keep the calendar stored in a cloud-based calendar service (like Google Calendar), and then use that service's API to work with the calendar. Google has a JavaScript API you can use for accessing Google Calendar, that might help you out.