rpicms

A CMS for the Raspberry Pi
git clone git://archive.git.mtrnord.blog/RpicmsTeam/rpicms.git
Log | Files | Refs | README | LICENSE

callback.php (900B)


      1 <?php
      2 
      3 use fkooman\OAuth\Client\GoogleClientConfig;
      4 use fkooman\OAuth\Client\Callback;
      5 use fkooman\OAuth\Client\SessionStorage;
      6 use fkooman\OAuth\Client\PdoStorage;
      7 use Guzzle\Http\Client;
      8 
      9 require_once 'vendor/autoload.php';
     10 
     11 /* OAuth client configuration */
     12 $clientConfig = new GoogleClientConfig(json_decode(file_get_contents("client_secrets.json"), true));
     13 
     14 try {
     15     //$db = new PDO(sprintf("sqlite:%s/data/client.sqlite", __DIR__));
     16     //$tokenStorage = new PdoStorage($db);
     17     $tokenStorage = new SessionStorage();
     18 
     19     /* initialize the Callback */
     20     $cb = new Callback("php-drive-client", $clientConfig, $tokenStorage, new Client());
     21     /* handle the callback */
     22     $cb->handleCallback($_GET);
     23 
     24     header("HTTP/1.1 302 Found");
     25     header("Location: https://fkooman.pagekite.me/php-drive-client/index.php");
     26 } catch (Exception $e) {
     27     echo sprintf("ERROR: %s", $e->getMessage());
     28 }