How to get today's events from Google Calendar (API) using JavaScript? - javascript

I'm new to Google Calendar APIs and what I'm trying to do is to display today's events from a public Google Calendar using JavaScript.
I've found this resource(dead link), but I can't figure it out how to modify it so that it will output only today's events.
Any help will be appreciated.

Take a look at the API: https://developers.google.com/calendar/quickstart/apps-script
You can set the start-min and start-max parameters.

AuthSub proxy authentication is used by web applications which need to authenticate their users to Google accounts. The website operator does not need access to the username and password for the calendar user - only special AuthSub tokens are required. Please see the AuthSub documentation for more detailed information.
When a user first visits your application, they have not yet been authenticated. In this case, you need to print some text and a link directing the user to Google to authenticate your request for access to their calendar. The Python Google Data API client library provides a function to generate this URL from the CalendarService class. The code below sets up a link to the AuthSubRequest page.

Related

Google Calendar API and API Key issues

OK.
So I am building a simple app for a friend. The biggest requirement for this app is that he wants a user to be able to go to his site and create an event on his google calendar. I have let him know that this calendar will have to be made public and he is fine with that. I created an API Key with google and the first call against the API with the API Key to get calendar events for a given day works fine. The second request, a post, returns :
err(401)"API keys are not supported by this API. Expected OAuth2 access token or other authentication credentials that assert a principal."
It doesn't make sense that his website would be an OAuth app because that would require the user have a gmail account.
There has got to be some kind of way to make this work ...
Thanks Everyone
I just want to make a post request to Google Calendar API using an API Key.
API keys only give read access. If you want write access you need the permission of the owner of the calendar
options
Create a google workspace account and use a service account with domain wide deligation
use Oauth2 have your friend auth it once store the refresh token and use the refresh token to request a new access token when ever you want to write to the calendar
neither option will work with client side JavaScript switch to a server side programming language

How to configure OAuth with Goodreads

I am building an app using HTML, CSS, and Javascript, and am trying to configure OAuth to use it to access data from the Goodreads API. I basically want to get a list of books that a Goodreads member has read in the current year and display statistics about the metadata of these books. I'm pretty new to Javascript and using API's and don't have a super good grasp on OAuth and API authentication in general so I would really appreciate it if it could be explained as simply as possible.
From what I understand I need to create a login button on my page that contains a link that looks something like this:
http://www.goodreads.com/oauth/authorize?oauth_token=SCDMymQWcIE8GnxmSA
When the user clicks this button they'll visit goodreads.com where they'll login to their account. After accepting the permissions, the user will be redirected to back to your site along with an access token that would contain the user's ID. At this point I would use the user ID to pull data about the books on their shelves.
I'm not really sure how to go about writing this in my Javascript file though. How do I go about authorizing via OAuth and storing the user's ID? From the Goodreads Developers group it seems like the Goodreads API uses OAuth 1.0 which I believe is relevant to how I will need to approach this.

Connect to non user calendar with google calendar api

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/

Google Calendar API - use Javascript to insert events in ANOTHER user's calendar

Trying to make a web app where others can view my availability and schedule an apt with me...so it will be them on their computer on my site. I can do the Oath just fine for me...but when someone else visits the site, it is just for their calendar. I can't seem to find anything on how to make it show my calendar. I've gone up and down the Google Calendar API page but can't seem to figure out how to make the user fixed on the api calls. Any help would be greatly appreciated!
You can create a service account, share your calendar read-write with this service account and then have this service account always be the authenticated user (instead of using Oauth). More on service accounts: https://developers.google.com/identity/protocols/OAuth2ServiceAccount

Registeration using Gmail account in asp.net javascript

I need my website users use gmail account to register to my site. And i need to implement this using javascript. I can't user server side code for this purpose.
Is there anyone who can guide me how can i do this.
Thanks in advance
You could use OAuth 2. Google has detailed documentation about how you could register a relying party and use the Authorization Code Grant Profile.
Google documentation for integrating a client side javascript application is available here: https://developers.google.com/accounts/docs/OAuth2UserAgent
Go through the documentation and if you have some specific questions with the implementation don't hesitate to come back, show your progress and explain the dofficulties you have encountered.
Once you receive the access_token in the fragment portion of the url, you could query other Google services with this token. Depending on the scopes that the user granted you when he authenticated, you will be able to access different services and level of information about this user.

Categories

Resources