php - Google calendar events do not show with approval prompt("auto") -


i listing google events in own calendar. worked fine, until changed approval_prompt auto force. not need refresh token every time user logs in (correct me if i'm wrong, i'm new google api).

another strange thing can still create, update, delete events. not list google calendar events.

here code:

login.php

$client = new google_client(); $client->setclientid($client_id); $client->setclientsecret($client_secret); $client->setredirecturi($redirect_uri);  $client->setscopes(array(     'email',     'https://www.googleapis.com/auth/calendar',     'https://www.googleapis.com/auth/plus.me'     ));  $client->setapprovalprompt('auto'); $client->setaccesstype("offline"); 

calendar.php:

var events = []; <?php              foreach ($results->getitems() $event) {             $now = new datetime();             $unformatted_start = new datetime($event->start->datetime);             $start = $event->start->datetime;             $end = $event->end->datetime;             $allday = false;             if (($event->getstart()->getdate())!= null) {                 $start = (new datetime($event->getstart()->getdate()))->format('y/m/d');                 $end = (new datetime($event->getend()->getdate()))->format('y/m/d');                 $allday = true;             }             $summary =$event->getsummary();             $event_url = $event->gethtmllink();             $is_matching = false;             foreach ($alleventids $id) {                //id->e_google_id above in file                if($event->getid()==$id->e_google_id){                     $is_matching = true;                     break;                }             }             if(!$is_matching){              ?>               events.push({title:"<?php echo $summary;?>",start:"<?php echo $start;?>",end:"<?php echo $end;?>",color: "<?php if($now>$unformatted_start){echo '#f3867e';}else {echo '#f44336';}?>",textcolor: 'white', url:"<?php echo $event_url;?>", allday:"<?php echo $allday;?>" })         <?php }} ?> 


Comments

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -