Esempio n. 1
0
$dataStore = new OAuth2\DataStore\Session();
$scope = null;
$service = new OAuth2\Service($client, $configuration, $dataStore, $scope);
if (isset($_GET['action'])) {
    switch ($_GET['action']) {
        case 'authorize':
            // redirects to authorize endpoint
            $service->authorize();
            break;
        case 'requestApi':
            // calls api endpoint with access token
            echo $service->callApiEndpoint('API_ENDPOINT');
            break;
        case 'revoke':
            // calls revoke access token
            echo $service->revokeAccessToken();
            break;
    }
}
if (isset($_GET['code'])) {
    // retrieve access token from endpoint
    $service->getAccessToken();
}
$token = $dataStore->retrieveAccessToken();
?>
<html>
    <head>
    </head>
    <body>
        Consumer Key: <input type="text" id="consumer-key" value="<?php 
echo $client->getClientKey();