DougAtPraxent / Eventry

A Google Chrome extension to facilitate periodic time entry in 10K' Plans based on Google Calendar event data
0 stars 0 forks source link

Get My Calendar Events #3

Open DougAtPraxent opened 6 years ago

DougAtPraxent commented 6 years ago

Google Calendar API JavaScript Quickstart https://developers.google.com/calendar/quickstart/js

  1. Confirm Python 2.4+ available for web server ('python --version' => v2.7 installed in my local environment); then 'python -m SimpleHTTPServer 8000' in the project directory

  2. Create a project in the Google Developers Console and turn on the Google Calendar API

  3. Set up OAuth credentials 'eventry-client' client ID = '984026966977-5bgo5545bhtrktnqlc4f8pg9g21f6m1h.apps.googleusercontent.com' client secret = 'cjnekZvOgDIDREA1SwNbDhwH'

  4. Create API key API key = 'AIzaSyDo30LSgpGD6aySTVekJawO6hiTpK0RFco'

Note: Restrict access to the API key to specific websites, IP addresses or mobile apps in production

  1. Create 'quickstart.html' file

  2. Replace '' and '' placeholders in the code

  3. Start the web server (python -m SimpleHTTPServer 8000) from the working directory (/Eventry) where the 'quickstart.html' file is saved

  4. Navigate to http://localhost:8000/quickstart.html in your browser

Note: The first time you run the sample, it will prompt you to authorize access

Note: After the initial user authorization, calls to 'gapi.auth.authorize that use 'immediate:true' mode will obtain an auth token without user interaction

SUCCESS!!!

DougAtPraxent commented 6 years ago

Created calendar-events.html -- a standalone page based on quickstart.html, where I worked out the details of (and calculations based on) the calendar event data we need. Then created gCal.js that generalized the login/authentication and added a 'listMyCalendarEvents(fromDate, toDate)' method to return the logged-in user's calendar event data for the given date range in JSON format