When trying to follow this example of implementing Google+ one-time-server-flow (hybrid): https://developers.google.com/+/web/signin/server-side-flow
I get the following error on my index page:
PHP Notice: Undefined variable: app in D:\home\site\wwwroot\beta\index.php on line 45 PHP Fatal error: Call to a member function set() on a non-object in D:\home\site\wwwroot\beta\index.php on line 45
<?php
require_once "includes/Google/Google_Client.php";
require_once "includes/Google/contrib/Google_PlusService.php";
// Create a state token to prevent request forgery.
// Store it in the session for later validation.
$state = md5(rand());
$app['session']->set('state', $state);
// Set the client ID, token state, and application name in the HTML while
// serving it.
return $app['twig']->render('index.php', array(
'CLIENT_ID' => "ID HERE",
'STATE' => $state,
'APPLICATION_NAME' => "TEST APP"
));
?>
I have replace the CLIENT ID and APP NAME with examples for the purpose of posting on here.
Does anyone know what could be causing these errors? Thanks
This may help: https://github.com/googleplus/gplus-verifytoken-php/blob/master/verify.php
$app = new Silex\Application();