Thanks Ray and James. Looks like we need change our design, I will try authsub when I get some free time.
Tony On 26 June 2011 11:15, Ray Baxter <[email protected]> wrote: > For an embedded calendar, or calendars, if you set the calendar access to > public, then the public can see it, subscribe to it, sync it to their mobile > device etc. This is handy for sports leagues, health clubs and other similar > places. > > Also, most people aren't willing to give others their passwords. I don't > give my wife my gmail password, I certainly wouldn't give it to a business > or website. > > Ray > > > On Thu, Jun 23, 2011 at 11:03 PM, Tony Zhang <[email protected]>wrote: > >> James, thanks for your detailed answer. I really appreciate it. >> >> In my case, customers store their gmail username and password in our >> database. So we don't bother to check the token. I have no problem to >> add/editing google calendar event for customers. >> >> I wonder if I go authsub approach, would it solve the empty page >> problem(would it show a login page)? >> >> Now I am really confused: what's the main purpose of bringing embed google >> calendar? if you have to login in another window, then you could do all your >> work there, why would you embed it? >> >> >> >> On 24 June 2011 14:40, James Bowler <[email protected]> wrote: >> >>> I might be off base, but it seems like you shouldn't be embedding a >>> calendar at all. To create an event on the user's behalf, you must get >>> their permission. to do that, send them to this link (add your url) >>> >>> http://www.google.com/accounts/AuthSubRequest?next=YOUR RETURN URL >>> &scope=http://www.google.com/calendar/feeds/&secure=&session=1 >>> >>> If they want, they can give you their permission to create the event for >>> them. if they're already logged into google, they can just click 'grant >>> permission'. if not, they will be prompted to login first. >>> >>> once they give you permission, google will return the user to your return >>> url, with a token in the url - you'll need this. >>> >>> this is called authsub: >>> http://code.google.com/apis/accounts/docs/AuthSub.html >>> >>> then, do something like this >>> >>> //first, install zend gdata >>> package<http://framework.zend.com/download/gdata> , >>> and require the below files >>> require_once 'Zend/Gdata/AuthSub.php'; >>> require_once 'Zend/Gdata/Calendar.php'; >>> //then, 'upgrade' the token >>> if(isset($_GET['token'])) { >>> $_SESSION['sessionToken'] = >>> Zend_Gdata_AuthSub::getAuthSubSessionToken($_GET['token']); >>> } >>> >>> then, create the client >>> $client = Zend_Gdata_AuthSub::getHttpClient($_SESSION['sessionToken']); >>> >>> then, use the client, and create the >>> event<http://code.google.com/apis/calendar/data/2.0/developers_guide_protocol.html#CreatingEvents> >>> >>> $tzOffset = timefxn($timezone); >>> $service = new Zend_Gdata_Calendar($client); >>> // Create a new entry using the calendar service's magic factory method >>> >>> $event= $service->newEventEntry(); >>> // Populate the event with the desired information >>> // Note that each attribute is crated as an instance of a matching class >>> $event->title = $service->newTitle($title); >>> $event->where = array($service->newWhere($where)); >>> $event->content =$service->newContent($desc); >>> $when = $service->newWhen(); >>> $when->startTime = "{$startDate}T{$startTime}:00.000{$tzOffset}:00"; >>> $when->endTime = "{$endDate}T{$endTime}:00.000{$tzOffset}:00"; >>> $event->when = array($when); >>> >>> >>> // Upload the event to the calendar server >>> $newEvent = $service->insertEvent($event); >>> >>> >>> probably more than you were looking for .. >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "Google Calendar Data API" group. >>> To post to this group, send email to >>> [email protected] >>> To unsubscribe from this group, send email to >>> [email protected] >>> For more options, visit this group at >>> http://code.google.com/apis/calendar/community/forum.html >>> >> >> >> >> -- >> Best regards, >> >> Tony Zhang >> 1place Limited >> Level 3, 11 Clayton Street, Newmarket |Auckland 1740, New Zealand >> Phone: +64 9 5200612 | Mob: +64 21 813900 >> Email: [email protected] | www.1placeonline.com >> >> -- >> You received this message because you are subscribed to the Google >> Groups "Google Calendar Data API" group. >> To post to this group, send email to >> [email protected] >> To unsubscribe from this group, send email to >> [email protected] >> For more options, visit this group at >> http://code.google.com/apis/calendar/community/forum.html >> > > -- > You received this message because you are subscribed to the Google > Groups "Google Calendar Data API" group. > To post to this group, send email to > [email protected] > To unsubscribe from this group, send email to > [email protected] > For more options, visit this group at > http://code.google.com/apis/calendar/community/forum.html > -- Best regards, Tony Zhang 1place Limited Level 3, 11 Clayton Street, Newmarket |Auckland 1740, New Zealand Phone: +64 9 5200612 | Mob: +64 21 813900 Email: [email protected] | www.1placeonline.com -- You received this message because you are subscribed to the Google Groups "Google Calendar Data API" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://code.google.com/apis/calendar/community/forum.html
