Using Codenvy to OAuth Google with php -


I am quite new to codenvy and php, but I have checked the following two times, I am not called in when I launch it with the following code. I have followed the instructions here to make any clear mistakes in the bottom?

  & lt; Php require_once 'src / Google / Client.php'; Need_once 'src / Google / Service / Analytics.php'; Session_start (); $ Client = new Google_Client (); $ Client- & gt; Set Application Name ('Hello Analytics API Sample'); // To generate your client client, visit https://console.developers.google.com/ and register your redirects. $ Client- & gt; SetClientId ('confirmed this is correct'); $ Client- & gt; SetClientSecret ('confirmed it is correct'); $ Customer & gt; SetRedirectUri ('https://codenvycorp.com/api/oauth/callback'); $ Client- & gt; SetDeveloperKey ('confirmed this is correct'); $ Customer & gt; SetScopes (array ('https://www.googleapis.com/auth/analytics.readonly')); // Magic. Instead of Associate Array, the object returns to the Analytics service from $ Customer & gt; SetUseObjects (true); If (isset ($ _GET ['code'])) {$ client- & gt; Authenticate (); $ _SESSION ['token'] = $ client- & gt; GetAccessToken (); $ Redirect = 'http: //' $ _SERVER ['HTTP_HOST'] $ _SERVER ['PHP_SELF']; Header ('location:' at filter_ ($ redirect, FILTER_SANITIZE_URL)); } If (isset ($ _ session ['token'])) {$ client- & gt; SetAccessToken ($ _ session ['token']); } If (! $ Client-> getAccessToken ()) {$ authUrl = $ client- & gt; CreateAuthUrl (); Print "& lt; a class = 'login' href = '$ authUrl' & gt; connect me! & Lt; / a & gt;"; } And {$ analytics = new APNetics service ($ customer); RunMainDemo ($ analytics); } Echo 'Hello World 321'; ? & Gt; If your project is public, please share it with Coden's factory feature. Therefore all people will be able to see what is wrong with the oath integration.  

(You can use the factory on the left panel of IDE)


Comments

Popular posts from this blog

c# - SignalR: "Protocol error: Unknown transport." when navigating to hub -

class - Kivy: how to instantiate a dynamic classes in python -

python - mayavi mapping a discrete colorbar on a surface -