PHP Classes

Accessing Google Calendar API from a server

Recommend this page to a friend!

      PHP OAuth Library  >  All threads  >  Accessing Google Calendar API from a...  >  (Un) Subscribe thread alerts  
Subject:Accessing Google Calendar API from a...
Summary:Is there a way to access a Google calendar WITHOUT a user?
Messages:2
Author:Serge Goldstein
Date:2014-03-31 18:41:24
Update:2014-03-31 22:07:04
 

  1. Accessing Google Calendar API from a...   Reply   Report abuse  
Picture of Serge Goldstein Serge Goldstein - 2014-03-31 18:41:24
I am working on some code that creates appointments for people. I want to be able to insert those appointments into their Google calendar (if they have one). The problem is, the target user will not be around when this insertion takes place. My plan for doing this was to add the event to MY calendar, and simply have the target user be an "attendee" at the event -- that way, they would receive an invitation to the event on their Google calendar. The problem is that there doesn't seem to be any way for me to add an event to my own Google calendar via the API without going through an OAUTH2 step that requires me to be around (and to authenticate the access via a web page). Does anyone have code that can run on a server which adds events to a Google calendar without anyone being around to authenticate (the credentials are passed internally)?

  2. Re: Accessing Google Calendar API from a...   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2014-03-31 22:07:04 - In reply to message 1 from Serge Goldstein
You need to obtain tokens for offline access. You only need to set the offline variable of the class to true. However, the tokens need to be stored in a persistent container like a database.

This article explains more in detail how to do it.

phpclasses.org/blog/package/7700/po ...