Example #1
0
<?php

require "flickrBootstrap.php";
use ArtaxApiBuilder\Service\OauthConfig;
$action = getVariable('action');
if ($action === 'delete') {
    unsetSessionVariable('oauthAccessToken');
    unsetSessionVariable('oauthRequest');
}
echo <<<END

<html>
<body>
<h3><a href='/'>Oauth test home</a> </h3>
END;
/** @var \AABTest\OauthAccessToken $oauthAccessToken */
$oauthAccessToken = getSessionVariable('oauthAccessToken');
if ($oauthAccessToken == null) {
    echo "<p>You are not flickr authorised.</p>";
    createOauthRequest();
} else {
    echo "<p>You are flickr authorised.</p>";
    showFlickrStatus($oauthAccessToken);
    echo "<p><a href='/flickr/index.php?action=delete'>Delete authority</a></p>";
}
echo <<<END

</body>
</html>

END;
Example #2
0
    if (!$accessResponse instanceof GithubService\Model\AccessResponse) {
        //class was renamed...or something else bad happened.
        setSessionVariable(GITHUB_ACCESS_RESPONSE_KEY, null);
        $accessResponse = null;
    }
}
$shareClasses = [];
if ($accessResponse) {
    $shareClasses['GithubService\\Model\\AccessResponse'] = $accessResponse;
}
$provider = createProvider([], $shareClasses);
//These actions need to be done before the rest of the page.
$action = getVariable('action');
switch ($action) {
    case 'delete':
        unsetSessionVariable(GITHUB_ACCESS_RESPONSE_KEY);
        $accessResponse = null;
        break;
    case 'revoke':
        revokeAuthority($accessResponse);
        break;
}
try {
    if ($accessResponse == null) {
        echo "<p>You are not github authorised. Please choose the permissions you want to test with:</p>";
        processUnauthorizedActions();
    } else {
        echo "<p>You are github authorised.</p>";
        try {
            processAction($provider, $accessResponse);
        } catch (GithubArtaxServiceException $gae) {
Example #3
0
use AABTest\GithubAPI\GithubAPI;
use AABTest\Github\AccessResponse;
use ArtaxApiBuilder\Service\StoredLink;
echo <<<END

<html>
<body>
<h3><a href='/'>Oauth test home</a> </h3>
END;
/** @var \AABTest\Github\AccessResponse */
$accessResponse = getSessionVariable('githubAccess');
//These actions need to be done before the rest of the page.
$action = getVariable('action');
switch ($action) {
    case 'delete':
        unsetSessionVariable('githubAccess');
        break;
    case 'revoke':
        revokeAuthority($accessResponse);
        break;
}
try {
    if ($accessResponse == null) {
        echo "<p>You are not github authorised.</p>";
        //        $scopes = [
        //            \ArtaxApiBuilder\Service\Github::SCOPE_USER_EMAIL,
        //            \ArtaxApiBuilder\Service\Github::SCOPE_ORG_READ,
        //            \ArtaxApiBuilder\Service\Github::SCOPE_USER
        //        ];
        //createOauthRequest();
        processUnauthorizedActions();