php - Google Calender API Login -


I'm new to the Google Calendar API. Now, my site is connected to my Google Calendar with Google API, the problem is that even after logging into my Google Account, I still have "Connect me!" The thing is looking, please help.

need_once 'src / Google_Client.php'; Need_once 'src / contrib / Google_CalendarService.php'; Session_start (); $ Client = new Google_Client (); $ Client- & gt; Set UpplugName ("Google Calendar PHP Starter App"); // To create your // Client ID, customer go to https://code.google.com/apis/console?api=calendar and register your redirect. $ Customer & gt; SetClientId ('my_oauth2_client_id'); $ Customer & gt; SetClientSecret ('my_oauth2_client_secret'); $ Customer & gt; SetRedirectUri ('my_oauth2_redirect_uri'); $ Customer & gt; SetDeveloperKey ('my_developer_key'); $ Cal = New Google_CalendarService ($ customer); If (isset ($ _GET ['logout'])) {Set ($ _ session ['token']); } If (isset ($ _ GET ['code'])) {$ client- & gt; Authenticate ($ _GET ['code']); $ _SESSION ['token'] = $ client- & gt; GetAccessToken (); Header ('location: http: //'. $ _SERVER ['HTTP_HOST']. $ _SERVER ['PHP_SELF']); } If (isset ($ _ session ['token'])) {$ client- & gt; SetAccessToken ($ _ session ['token']); } If ($ client-> getAccessToken ()) {$ calList = $ cal- & gt; Calendar List- & gt; List calendar address (); Print "& lt; h1 & gt; Calendar List & lt; / h1 & gt; & lt; Pre & gt;" . Print_r ($ calList, true) "& lt; / pre & gt;"; $ _SESSION ['token'] = $ client- & gt; GetAccessToken (); } And {$ authUrl = $ client- & gt; CreateAuthUrl (); Print "& lt; a class = 'login' href = '$ authUrl' & gt; connect me! & Lt; / a & gt;"; }


Comments

Popular posts from this blog

ios - How do I use CFArrayRef in Swift? -

eclipse plugin - Run java code error: Workspace is closed -

c - Error on building source code in VC 6 -