diff options
Diffstat (limited to 'vendor/lusitanian/oauth/examples')
31 files changed, 0 insertions, 1817 deletions
diff --git a/vendor/lusitanian/oauth/examples/amazon.php b/vendor/lusitanian/oauth/examples/amazon.php deleted file mode 100644 index 0798eafc..00000000 --- a/vendor/lusitanian/oauth/examples/amazon.php +++ /dev/null @@ -1,52 +0,0 @@ -<?php - -/** - * Example of retrieving an authentication token of the Amazon service - * - * PHP version 5.4 - * - * @author Flávio Heleno <flaviohbatista@gmail.com> - * @copyright Copyright (c) 2012 The authors - * @license http://www.opensource.org/licenses/mit-license.html MIT License - */ - -use OAuth\OAuth2\Service\Amazon; -use OAuth\Common\Storage\Session; -use OAuth\Common\Consumer\Credentials; - -/** - * Bootstrap the example - */ -require_once __DIR__ . '/bootstrap.php'; - -// Session storage -$storage = new Session(); - -// Setup the credentials for the requests -$credentials = new Credentials( - $servicesCredentials['amazon']['key'], - $servicesCredentials['amazon']['secret'], - $currentUri->getAbsoluteUri() -); - -// Instantiate the Amazon service using the credentials, http client, storage mechanism for the token and profile scope -/** @var $amazonService Amazon */ -$amazonService = $serviceFactory->createService('amazon', $credentials, $storage, array('profile')); - -if (!empty($_GET['code'])) { - // This was a callback request from Amazon, get the token - $token = $amazonService->requestAccessToken($_GET['code']); - - // Send a request with it - $result = json_decode($amazonService->request('/user/profile'), true); - - // Show some of the resultant data - echo 'Your unique Amazon user id is: ' . $result['user_id'] . ' and your name is ' . $result['name']; - -} elseif (!empty($_GET['go']) && $_GET['go'] === 'go') { - $url = $amazonService->getAuthorizationUri(); - header('Location: ' . $url); -} else { - $url = $currentUri->getRelativeUri() . '?go=go'; - echo "<a href='$url'>Login with Amazon!</a>"; -} diff --git a/vendor/lusitanian/oauth/examples/bitbucket.php b/vendor/lusitanian/oauth/examples/bitbucket.php deleted file mode 100644 index d9330961..00000000 --- a/vendor/lusitanian/oauth/examples/bitbucket.php +++ /dev/null @@ -1,64 +0,0 @@ -<?php - -/** - * Example of retrieving an authentication token from the BitBucket service - * - * PHP version 5.4 - * @author Ændrew Rininsland <me@aendrew.com> - * - * Shamelessly cribbed from work by: - * @author David Desberg <david@daviddesberg.com> - * @author Pieter Hordijk <info@pieterhordijk.com> - * @copyright Copyright (c) 2012 The authors - * @license http://www.opensource.org/licenses/mit-license.html MIT License - */ - -use OAuth\OAuth1\Service\BitBucket; -use OAuth\Common\Storage\Session; -use OAuth\Common\Consumer\Credentials; - -/** - * Bootstrap the example - */ -require_once __DIR__ . '/bootstrap.php'; - -// We need to use a persistent storage to save the token, because oauth1 requires the token secret received before' -// the redirect (request token request) in the access token request. -$storage = new Session(); - -// Setup the credentials for the requests -$credentials = new Credentials( - $servicesCredentials['bitbucket']['key'], - $servicesCredentials['bitbucket']['secret'], - $currentUri->getAbsoluteUri() -); - -// Instantiate the BitBucket service using the credentials, http client and storage mechanism for the token -/** @var $bbService BitBucket */ -$bbService = $serviceFactory->createService('BitBucket', $credentials, $storage); - -if (!empty($_GET['oauth_token'])) { - $token = $storage->retrieveAccessToken('BitBucket'); - - // This was a callback request from BitBucket, get the token - $bbService->requestAccessToken( - $_GET['oauth_token'], - $_GET['oauth_verifier'], - $token->getRequestTokenSecret() - ); - - // Send a request now that we have access token - $result = json_decode($bbService->request('user/repositories')); - - echo('The first repo in the list is ' . $result[0]->name); - -} elseif (!empty($_GET['go']) && $_GET['go'] === 'go') { - // extra request needed for oauth1 to request a request token :-) - $token = $bbService->requestRequestToken(); - - $url = $bbService->getAuthorizationUri(array('oauth_token' => $token->getRequestToken())); - header('Location: ' . $url); -} else { - $url = $currentUri->getRelativeUri() . '?go=go'; - echo "<a href='$url'>Login with BitBucket!</a>"; -} diff --git a/vendor/lusitanian/oauth/examples/bitly.php b/vendor/lusitanian/oauth/examples/bitly.php deleted file mode 100644 index 9cd27e34..00000000 --- a/vendor/lusitanian/oauth/examples/bitly.php +++ /dev/null @@ -1,53 +0,0 @@ -<?php - -/** - * Example of retrieving an authentication token of the Bitly service - * - * PHP version 5.4 - * - * @author David Desberg <david@daviddesberg.com> - * @author Pieter Hordijk <info@pieterhordijk.com> - * @copyright Copyright (c) 2012 The authors - * @license http://www.opensource.org/licenses/mit-license.html MIT License - */ - -use OAuth\OAuth2\Service\Bitly; -use OAuth\Common\Storage\Session; -use OAuth\Common\Consumer\Credentials; - -/** - * Bootstrap the example - */ -require_once __DIR__ . '/bootstrap.php'; - -// Session storage -$storage = new Session(); - -// Setup the credentials for the requests -$credentials = new Credentials( - $servicesCredentials['bitly']['key'], - $servicesCredentials['bitly']['secret'], - $currentUri->getAbsoluteUri() -); - -// Instantiate the Bitly service using the credentials, http client and storage mechanism for the token -/** @var $bitlyService Bitly */ -$bitlyService = $serviceFactory->createService('bitly', $credentials, $storage); - -if (!empty($_GET['code'])) { - // This was a callback request from bitly, get the token - $bitlyService->requestAccessToken($_GET['code']); - - // Send a request with it - $result = json_decode($bitlyService->request('user/info'), true); - - // Show some of the resultant data - echo 'Your unique user id is: ' . $result['data']['login'] . ' and your name is ' . $result['data']['display_name']; - -} elseif (!empty($_GET['go']) && $_GET['go'] === 'go') { - $url = $bitlyService->getAuthorizationUri(); - header('Location: ' . $url); -} else { - $url = $currentUri->getRelativeUri() . '?go=go'; - echo "<a href='$url'>Login with Bitly!</a>"; -} diff --git a/vendor/lusitanian/oauth/examples/bootstrap.php b/vendor/lusitanian/oauth/examples/bootstrap.php deleted file mode 100644 index f02da414..00000000 --- a/vendor/lusitanian/oauth/examples/bootstrap.php +++ /dev/null @@ -1,29 +0,0 @@ -<?php - -/** - * Bootstrap the library - */ -require_once __DIR__ . '/../vendor/autoload.php'; - -/** - * Setup error reporting - */ -error_reporting(E_ALL); -ini_set('display_errors', 1); - -/** - * Setup the timezone - */ -ini_set('date.timezone', 'Europe/Amsterdam'); - -/** - * Create a new instance of the URI class with the current URI, stripping the query string - */ -$uriFactory = new \OAuth\Common\Http\Uri\UriFactory(); -$currentUri = $uriFactory->createFromSuperGlobalArray($_SERVER); -$currentUri->setQuery(''); - -/** - * Load the credential for the different services - */ -require_once __DIR__ . '/init.php'; diff --git a/vendor/lusitanian/oauth/examples/box.php b/vendor/lusitanian/oauth/examples/box.php deleted file mode 100644 index f1b06443..00000000 --- a/vendor/lusitanian/oauth/examples/box.php +++ /dev/null @@ -1,58 +0,0 @@ -<?php - -/** - * Example of retrieving an authentication token of the Box service - * - * PHP version 5.4 - * - * @author David Desberg <david@daviddesberg.com> - * @author Pieter Hordijk <info@pieterhordijk.com> - * @author Antoine Corcy <contact@sbin.dk> - * @copyright Copyright (c) 2012 The authors - * @license http://www.opensource.org/licenses/mit-license.html MIT License - */ - -use OAuth\OAuth2\Service\Box; -use OAuth\Common\Storage\Session; -use OAuth\Common\Consumer\Credentials; - -/** - * Bootstrap the example - */ -require_once __DIR__ . '/bootstrap.php'; - -// Session storage -$storage = new Session(); - -// Setup the credentials for the requests -$credentials = new Credentials( - $servicesCredentials['box']['key'], - $servicesCredentials['box']['secret'], - $currentUri->getAbsoluteUri() -); - -// Instantiate the Box service using the credentials, http client and storage mechanism for the token -/** @var $boxService Box */ -$boxService = $serviceFactory->createService('box', $credentials, $storage); - -if (!empty($_GET['code'])) { - // retrieve the CSRF state parameter - $state = isset($_GET['state']) ? $_GET['state'] : null; - - // This was a callback request from box, get the token - $token = $boxService->requestAccessToken($_GET['code'], $state); - - // Send a request with it - $result = json_decode($boxService->request('/users/me'), true); - - // Show some of the resultant data - echo 'Your Box name is ' . $result['name'] . ' and your email is ' . $result['login']; - -} elseif (!empty($_GET['go']) && $_GET['go'] === 'go') { - $url = $boxService->getAuthorizationUri(); - // var_dump($url); - header('Location: ' . $url); -} else { - $url = $currentUri->getRelativeUri() . '?go=go'; - echo "<a href='$url'>Login with Box!</a>"; -} diff --git a/vendor/lusitanian/oauth/examples/buffer.php b/vendor/lusitanian/oauth/examples/buffer.php deleted file mode 100644 index c1b9ddde..00000000 --- a/vendor/lusitanian/oauth/examples/buffer.php +++ /dev/null @@ -1,53 +0,0 @@ -<?php - -/** - * Example of retrieving an authentication token of the Buffer service - * - * PHP version 5.4 - * - * @author David Desberg <david@daviddesberg.com> - * @author Pieter Hordijk <info@pieterhordijk.com> - * @copyright Copyright (c) 2012 The authors - * @license http://www.opensource.org/licenses/mit-license.html MIT License - */ - -use OAuth\OAuth2\Service\Buffer; -use OAuth\Common\Storage\Session; -use OAuth\Common\Consumer\Credentials; - -/** - * Bootstrap the example - */ -require_once __DIR__ . '/bootstrap.php'; - -// Session storage -$storage = new Session(); - -// Setup the credentials for the requests -$credentials = new Credentials( - $servicesCredentials['buffer']['key'], - $servicesCredentials['buffer']['secret'], - $currentUri->getAbsoluteUri() -); - -// Instantiate the buffer service using the credentials, http client and storage mechanism for the token -/** @var $bufferService buffer */ -$bufferService = $serviceFactory->createService('buffer', $credentials, $storage); - -if (!empty($_GET['code'])) { - // This was a callback request from buffer, get the token - $bufferService->requestAccessToken($_GET['code']); - - // Send a request with it - $result = json_decode($bufferService->request('user.json'), true); - - // Show some of the resultant data - echo 'Your unique user id is: ' . $result['id'] . ' and your plan is ' . $result['plan']; - -} elseif (!empty($_GET['go']) && $_GET['go'] === 'go') { - $url = $bufferService->getAuthorizationUri(); - header('Location: ' . $url); -} else { - $url = $currentUri->getRelativeUri() . '?go=go'; - echo "<a href='$url'>Login with buffer!</a>"; -} diff --git a/vendor/lusitanian/oauth/examples/dailymotion.php b/vendor/lusitanian/oauth/examples/dailymotion.php deleted file mode 100644 index 53f0878a..00000000 --- a/vendor/lusitanian/oauth/examples/dailymotion.php +++ /dev/null @@ -1,52 +0,0 @@ -<?php - -/** - * Example of retrieving an authentication token of the Dailymotion service - * - * PHP version 5.4 - * - * @author Mouhamed SEYE <mouhamed@seye.pro> - * @copyright Copyright (c) 2012 The authors - * @license http://www.opensource.org/licenses/mit-license.html MIT License - */ - -use OAuth\OAuth2\Service\Dailymotion; -use OAuth\Common\Storage\Session; -use OAuth\Common\Consumer\Credentials; - -/** - * Bootstrap the example - */ -require_once __DIR__ . '/bootstrap.php'; - -// Session storage -$storage = new Session(); - -// Setup the credentials for the requests -$credentials = new Credentials( - $servicesCredentials['dailymotion']['key'], - $servicesCredentials['dailymotion']['secret'], - $currentUri->getAbsoluteUri() -); - -// Instantiate the Dailymotion service using the credentials, http client, storage mechanism for the token and email scope -/** @var $dailymotionService Dailymotion */ -$dailymotionService = $serviceFactory->createService('dailymotion', $credentials, $storage, array('email')); - -if (!empty($_GET['code'])) { - // This was a callback request from Dailymotion, get the token - $token = $dailymotionService->requestAccessToken($_GET['code']); - - // Send a request with it - $result = json_decode($dailymotionService->request('/me?fields=email,id'), true); - - // Show some of the resultant data - echo 'Your unique Dailymotion user id is: ' . $result['id'] . ' and your email is ' . $result['email']; - -} elseif (!empty($_GET['go']) && $_GET['go'] === 'go') { - $url = $dailymotionService->getAuthorizationUri(); - header('Location: ' . $url); -} else { - $url = $currentUri->getRelativeUri() . '?go=go'; - echo "<a href='$url'>Login with Dailymotion!</a>"; -} diff --git a/vendor/lusitanian/oauth/examples/dropbox.php b/vendor/lusitanian/oauth/examples/dropbox.php deleted file mode 100644 index 0d60551c..00000000 --- a/vendor/lusitanian/oauth/examples/dropbox.php +++ /dev/null @@ -1,52 +0,0 @@ -<?php - -/** - * Example of retrieving an authentication token of the Dropbox service - * - * PHP version 5.4 - * - * @author Flávio Heleno <flaviohbatista@gmail.com> - * @copyright Copyright (c) 2012 The authors - * @license http://www.opensource.org/licenses/mit-license.html MIT License - */ - -use OAuth\OAuth2\Service\Dropbox; -use OAuth\Common\Storage\Session; -use OAuth\Common\Consumer\Credentials; - -/** - * Bootstrap the example - */ -require_once __DIR__ . '/bootstrap.php'; - -// Session storage -$storage = new Session(); - -// Setup the credentials for the requests -$credentials = new Credentials( - $servicesCredentials['dropbox']['key'], - $servicesCredentials['dropbox']['secret'], - $currentUri->getAbsoluteUri() -); - -// Instantiate the Dropbox service using the credentials, http client and storage mechanism for the token -/** @var $dropboxService Dropbox */ -$dropboxService = $serviceFactory->createService('dropbox', $credentials, $storage, array()); - -if (!empty($_GET['code'])) { - // This was a callback request from Dropbox, get the token - $token = $dropboxService->requestAccessToken($_GET['code']); - - // Send a request with it - $result = json_decode($dropboxService->request('/account/info'), true); - - // Show some of the resultant data - echo 'Your unique Dropbox user id is: ' . $result['uid'] . ' and your name is ' . $result['display_name']; - -} elseif (!empty($_GET['go']) && $_GET['go'] === 'go') { - $url = $dropboxService->getAuthorizationUri(); - header('Location: ' . $url); -} else { - $url = $currentUri->getRelativeUri() . '?go=go'; - echo "<a href='$url'>Login with Dropbox!</a>"; -} diff --git a/vendor/lusitanian/oauth/examples/etsy.php b/vendor/lusitanian/oauth/examples/etsy.php deleted file mode 100644 index 0c0b79b7..00000000 --- a/vendor/lusitanian/oauth/examples/etsy.php +++ /dev/null @@ -1,59 +0,0 @@ -<?php - -/** - * Example of retrieving an authentication token of the Etsy service - * - * PHP version 5.4 - * - * @author Iñaki Abete <inakiabt+github@gmail.com> - * @copyright Copyright (c) 2013 The authors - * @license http://www.opensource.org/licenses/mit-license.html MIT License - */ - -use OAuth\OAuth1\Service\Etsy; -use OAuth\Common\Storage\Session; -use OAuth\Common\Consumer\Credentials; - -/** - * Bootstrap the example - */ -require_once __DIR__ . '/bootstrap.php'; - -// Session storage -$storage = new Session(); - -// Setup the credentials for the requests -$credentials = new Credentials( - $servicesCredentials['etsy']['key'], - $servicesCredentials['etsy']['secret'], - $currentUri->getAbsoluteUri() -); - -// Instantiate the Etsy service using the credentials, http client and storage mechanism for the token -/** @var $etsyService Etsy */ -$etsyService = $serviceFactory->createService('Etsy', $credentials, $storage); - -if (!empty($_GET['oauth_token'])) { - $token = $storage->retrieveAccessToken('Etsy'); - - // This was a callback request from Etsy, get the token - $etsyService->requestAccessToken( - $_GET['oauth_token'], - $_GET['oauth_verifier'], - $token->getRequestTokenSecret() - ); - - // Send a request now that we have access token - $result = json_decode($etsyService->request('/private/users/__SELF__')); - - echo 'result: <pre>' . print_r($result, true) . '</pre>'; - -} elseif (!empty($_GET['go']) && $_GET['go'] === 'go') { - $response = $etsyService->requestRequestToken(); - $extra = $response->getExtraParams(); - $url = $extra['login_url']; - header('Location: ' . $url); -} else { - $url = $currentUri->getRelativeUri() . '?go=go'; - echo "<a href='$url'>Login with Etsy!</a>"; -} diff --git a/vendor/lusitanian/oauth/examples/facebook.php b/vendor/lusitanian/oauth/examples/facebook.php deleted file mode 100644 index b6426721..00000000 --- a/vendor/lusitanian/oauth/examples/facebook.php +++ /dev/null @@ -1,54 +0,0 @@ -<?php - -/** - * Example of retrieving an authentication token of the Facebook service - * - * PHP version 5.4 - * - * @author Benjamin Bender <bb@codepoet.de> - * @author David Desberg <david@daviddesberg.com> - * @author Pieter Hordijk <info@pieterhordijk.com> - * @copyright Copyright (c) 2012 The authors - * @license http://www.opensource.org/licenses/mit-license.html MIT License - */ - -use OAuth\OAuth2\Service\Facebook; -use OAuth\Common\Storage\Session; -use OAuth\Common\Consumer\Credentials; - -/** - * Bootstrap the example - */ -require_once __DIR__ . '/bootstrap.php'; - -// Session storage -$storage = new Session(); - -// Setup the credentials for the requests -$credentials = new Credentials( - $servicesCredentials['facebook']['key'], - $servicesCredentials['facebook']['secret'], - $currentUri->getAbsoluteUri() -); - -// Instantiate the Facebook service using the credentials, http client and storage mechanism for the token -/** @var $facebookService Facebook */ -$facebookService = $serviceFactory->createService('facebook', $credentials, $storage, array()); - -if (!empty($_GET['code'])) { - // This was a callback request from facebook, get the token - $token = $facebookService->requestAccessToken($_GET['code']); - - // Send a request with it - $result = json_decode($facebookService->request('/me'), true); - - // Show some of the resultant data - echo 'Your unique facebook user id is: ' . $result['id'] . ' and your name is ' . $result['name']; - -} elseif (!empty($_GET['go']) && $_GET['go'] === 'go') { - $url = $facebookService->getAuthorizationUri(); - header('Location: ' . $url); -} else { - $url = $currentUri->getRelativeUri() . '?go=go'; - echo "<a href='$url'>Login with Facebook!</a>"; -} diff --git a/vendor/lusitanian/oauth/examples/fitbit.php b/vendor/lusitanian/oauth/examples/fitbit.php deleted file mode 100644 index 35b3d09f..00000000 --- a/vendor/lusitanian/oauth/examples/fitbit.php +++ /dev/null @@ -1,61 +0,0 @@ -<?php - -/** - * Example of retrieving an authentication token of the FitBit service - * - * PHP version 5.4 - * - * @author David Desberg <david@daviddesberg.com> - * @author Pieter Hordijk <info@pieterhordijk.com> - * @copyright Copyright (c) 2012 The authors - * @license http://www.opensource.org/licenses/mit-license.html MIT License - */ - -use OAuth\OAuth1\Service\FitBit; -use OAuth\Common\Storage\Session; -use OAuth\Common\Consumer\Credentials; - -/** - * Bootstrap the example - */ -require_once __DIR__ . '/bootstrap.php'; - -// Session storage -$storage = new Session(); - -// Setup the credentials for the requests -$credentials = new Credentials( - $servicesCredentials['fitbit']['key'], - $servicesCredentials['fitbit']['secret'], - $currentUri->getAbsoluteUri() -); - -// Instantiate the FitBit service using the credentials, http client and storage mechanism for the token -/** @var $fitbitService FitBit */ -$fitbitService = $serviceFactory->createService('FitBit', $credentials, $storage); - -if (!empty($_GET['oauth_token'])) { - $token = $storage->retrieveAccessToken('FitBit'); - - // This was a callback request from fitbit, get the token - $fitbitService->requestAccessToken( - $_GET['oauth_token'], - $_GET['oauth_verifier'], - $token->getRequestTokenSecret() - ); - - // Send a request now that we have access token - $result = json_decode($fitbitService->request('user/-/profile.json')); - - echo 'result: <pre>' . print_r($result, true) . '</pre>'; - -} elseif (!empty($_GET['go']) && $_GET['go'] === 'go') { - // extra request needed for oauth1 to request a request token :-) - $token = $fitbitService->requestRequestToken(); - - $url = $fitbitService->getAuthorizationUri(array('oauth_token' => $token->getRequestToken())); - header('Location: ' . $url); -} else { - $url = $currentUri->getRelativeUri() . '?go=go'; - echo "<a href='$url'>Login with FitBit!</a>"; -} diff --git a/vendor/lusitanian/oauth/examples/flickr.php b/vendor/lusitanian/oauth/examples/flickr.php deleted file mode 100644 index f7a80f67..00000000 --- a/vendor/lusitanian/oauth/examples/flickr.php +++ /dev/null @@ -1,80 +0,0 @@ -<?php - -/** - * Example of retrieving an authentication token of the Flickr service - * - * @author Christian Mayer <thefox21at@gmail.com> - * @copyright Copyright (c) 2013 The authors - * @license http://www.opensource.org/licenses/mit-license.html MIT License - */ - -use OAuth\OAuth1\Service\Flickr; -use OAuth\Common\Storage\Session; -use OAuth\Common\Consumer\Credentials; -use OAuth\Common\Http\Client\CurlClient; - -/** - * Bootstrap the example - */ -require_once __DIR__.'/bootstrap.php'; - -// Session storage -$storage = new Session(); - -// Setup the credentials for the requests -$credentials = new Credentials( - $servicesCredentials['flickr']['key'], - $servicesCredentials['flickr']['secret'], - $currentUri->getAbsoluteUri() -); - -// Instantiate the Flickr service using the credentials, http client and storage mechanism for the token -$flickrService = $serviceFactory->createService('Flickr', $credentials, $storage); - -$step = isset($_GET['step']) ? (int)$_GET['step'] : null; - -$oauth_token = isset($_GET['oauth_token']) ? $_GET['oauth_token'] : null; -$oauth_verifier = isset($_GET['oauth_verifier']) ? $_GET['oauth_verifier'] : null; - -if($oauth_token && $oauth_verifier){ - $step = 2; -} - -switch($step){ - default: - print "<a href='".$currentUri->getRelativeUri().'?step=1'."'>Login with Flickr!</a>"; - break; - - case 1: - - if($token = $flickrService->requestRequestToken()){ - $oauth_token = $token->getAccessToken(); - $secret = $token->getAccessTokenSecret(); - - if($oauth_token && $secret){ - $url = $flickrService->getAuthorizationUri(array('oauth_token' => $oauth_token, 'perms' => 'write')); - header('Location: '.$url); - } - } - - break; - - case 2: - $token = $storage->retrieveAccessToken('Flickr'); - $secret = $token->getAccessTokenSecret(); - - if($token = $flickrService->requestAccessToken($oauth_token, $oauth_verifier, $secret)){ - $oauth_token = $token->getAccessToken(); - $secret = $token->getAccessTokenSecret(); - - $storage->storeAccessToken('Flickr', $token); - - header('Location: '.$currentUri->getAbsoluteUri().'?step=3'); - } - break; - - case 3: - $xml = simplexml_load_string($flickrService->request('flickr.test.login')); - print "status: ".(string)$xml->attributes()->stat."\n"; - break; -} diff --git a/vendor/lusitanian/oauth/examples/foursquare.php b/vendor/lusitanian/oauth/examples/foursquare.php deleted file mode 100644 index f7920724..00000000 --- a/vendor/lusitanian/oauth/examples/foursquare.php +++ /dev/null @@ -1,53 +0,0 @@ -<?php - -/** - * Example of retrieving an authentication token of the Foursquare service - * - * PHP version 5.4 - * - * @author David Desberg <david@daviddesberg.com> - * @author Pieter Hordijk <info@pieterhordijk.com> - * @copyright Copyright (c) 2012 The authors - * @license http://www.opensource.org/licenses/mit-license.html MIT License - */ - -use OAuth\OAuth2\Service\Foursquare; -use OAuth\Common\Storage\Session; -use OAuth\Common\Consumer\Credentials; - -/** - * Bootstrap the example - */ -require_once __DIR__ . '/bootstrap.php'; - -// Session storage -$storage = new Session(); - -// Setup the credentials for the requests -$credentials = new Credentials( - $servicesCredentials['foursquare']['key'], - $servicesCredentials['foursquare']['secret'], - $currentUri->getAbsoluteUri() -); - -// Instantiate the Foursquare service using the credentials, http client and storage mechanism for the token -/** @var $foursquareService Foursquare */ -$foursquareService = $serviceFactory->createService('foursquare', $credentials, $storage); - -if (!empty($_GET['code'])) { - // This was a callback request from foursquare, get the token - $foursquareService->requestAccessToken($_GET['code']); - - // Send a request with it - $result = json_decode($foursquareService->request('users/self'), true); - - // Show some of the resultant data - echo 'Your unique foursquare user id is: ' . $result['response']['user']['id'] . ' and your name is ' . $result['response']['user']['firstName'] . $result['response']['user']['lastName']; - -} elseif (!empty($_GET['go']) && $_GET['go'] === 'go') { - $url = $foursquareService->getAuthorizationUri(); - header('Location: ' . $url); -} else { - $url = $currentUri->getRelativeUri() . '?go=go'; - echo "<a href='$url'>Login with Foursquare!</a>"; -} diff --git a/vendor/lusitanian/oauth/examples/github.php b/vendor/lusitanian/oauth/examples/github.php deleted file mode 100644 index 23e971f8..00000000 --- a/vendor/lusitanian/oauth/examples/github.php +++ /dev/null @@ -1,52 +0,0 @@ -<?php - -/** - * Example of retrieving an authentication token of the Github service - * - * PHP version 5.4 - * - * @author David Desberg <david@daviddesberg.com> - * @author Pieter Hordijk <info@pieterhordijk.com> - * @copyright Copyright (c) 2012 The authors - * @license http://www.opensource.org/licenses/mit-license.html MIT License - */ - -use OAuth\OAuth2\Service\GitHub; -use OAuth\Common\Storage\Session; -use OAuth\Common\Consumer\Credentials; - -/** - * Bootstrap the example - */ -require_once __DIR__ . '/bootstrap.php'; - -// Session storage -$storage = new Session(); - -// Setup the credentials for the requests -$credentials = new Credentials( - $servicesCredentials['github']['key'], - $servicesCredentials['github']['secret'], - $currentUri->getAbsoluteUri() -); - -// Instantiate the GitHub service using the credentials, http client and storage mechanism for the token -/** @var $gitHub GitHub */ -$gitHub = $serviceFactory->createService('GitHub', $credentials, $storage, array('user')); - -if (!empty($_GET['code'])) { - // This was a callback request from github, get the token - $gitHub->requestAccessToken($_GET['code']); - - $result = json_decode($gitHub->request('user/emails'), true); - - echo 'The first email on your github account is ' . $result[0]; - -} elseif (!empty($_GET['go']) && $_GET['go'] === 'go') { - $url = $gitHub->getAuthorizationUri(); - header('Location: ' . $url); - -} else { - $url = $currentUri->getRelativeUri() . '?go=go'; - echo "<a href='$url'>Login with Github!</a>"; -} diff --git a/vendor/lusitanian/oauth/examples/google.php b/vendor/lusitanian/oauth/examples/google.php deleted file mode 100644 index f05a03e0..00000000 --- a/vendor/lusitanian/oauth/examples/google.php +++ /dev/null @@ -1,53 +0,0 @@ -<?php - -/** - * Example of retrieving an authentication token of the Google service - * - * PHP version 5.4 - * - * @author David Desberg <david@daviddesberg.com> - * @author Pieter Hordijk <info@pieterhordijk.com> - * @copyright Copyright (c) 2012 The authors - * @license http://www.opensource.org/licenses/mit-license.html MIT License - */ - -use OAuth\OAuth2\Service\Google; -use OAuth\Common\Storage\Session; -use OAuth\Common\Consumer\Credentials; - -/** - * Bootstrap the example - */ -require_once __DIR__ . '/bootstrap.php'; - -// Session storage -$storage = new Session(); - -// Setup the credentials for the requests -$credentials = new Credentials( - $servicesCredentials['google']['key'], - $servicesCredentials['google']['secret'], - $currentUri->getAbsoluteUri() -); - -// Instantiate the Google service using the credentials, http client and storage mechanism for the token -/** @var $googleService Google */ -$googleService = $serviceFactory->createService('google', $credentials, $storage, array('userinfo_email', 'userinfo_profile')); - -if (!empty($_GET['code'])) { - // This was a callback request from google, get the token - $googleService->requestAccessToken($_GET['code']); - - // Send a request with it - $result = json_decode($googleService->request('https://www.googleapis.com/oauth2/v1/userinfo'), true); - - // Show some of the resultant data - echo 'Your unique google user id is: ' . $result['id'] . ' and your name is ' . $result['name']; - -} elseif (!empty($_GET['go']) && $_GET['go'] === 'go') { - $url = $googleService->getAuthorizationUri(); - header('Location: ' . $url); -} else { - $url = $currentUri->getRelativeUri() . '?go=go'; - echo "<a href='$url'>Login with Google!</a>"; -} diff --git a/vendor/lusitanian/oauth/examples/harvest.php b/vendor/lusitanian/oauth/examples/harvest.php deleted file mode 100644 index 1d11584a..00000000 --- a/vendor/lusitanian/oauth/examples/harvest.php +++ /dev/null @@ -1,74 +0,0 @@ -<?php - -/** - * Example of retrieving an authentication token of the harvest service - * - * PHP version 5.4 - * - * @author David Desberg <david@daviddesberg.com> - * @author Pieter Hordijk <info@pieterhordijk.com> - * @copyright Copyright (c) 2012 The authors - * @license http://www.opensource.org/licenses/mit-license.html MIT License - */ - -use OAuth\Common\Consumer\Credentials; -use OAuth\Common\Storage\Session; -use OAuth\Common\Token\Exception\ExpiredTokenException; -use OAuth\OAuth2\Service\Harvest; - -/** - * Bootstrap the example - */ -require_once __DIR__ . '/bootstrap.php'; - -$serviceName = 'Harvest'; -$scopes = array(); - -// Session storage -$storage = new Session(); - -// Setup the credentials for the requests -$credentials = new Credentials( - $servicesCredentials['harvest']['key'], - $servicesCredentials['harvest']['secret'], - $currentUri->getAbsoluteUri() -); - -// Instantiate the Harvest service using the credentials, http client and storage mechanism for the token -/** @var $harves Harves */ -$harvest = $serviceFactory->createService($serviceName, $credentials, $storage, $scopes); - -if (!empty($_GET['clearToken'])) { - // Clear the current AccessToken and go back to the Beginning. - $storage->clearToken($serviceName); - header('Location: ' . $currentUri->getAbsoluteUri()); - -} elseif ($storage->hasAccessToken($serviceName)) { - // fetch the accessToken for the service - $accessToken = $storage->retrieveAccessToken($serviceName); - - // is the accessToken expired? then let's refesh it! - if ($accessToken->isExpired() === TRUE) { - $harvest->refreshAccessToken($accessToken); - } - - // use the service with the valid access token to fetch my email - $result = json_decode($harvest->request('account/who_am_i'), true); - echo 'The email on your harvest account is ' . $result['user']['email']; - - $url = $currentUri->getRelativeUri() . '?clearToken=1'; - echo " <a href='$url'>Click here to clear the current access token</a>"; - -} elseif (!empty($_GET['code'])) { - // This was a callback request from harvest, get the token - $harvest->requestAccessToken($_GET['code']); - header('Location: ' . $currentUri->getAbsoluteUri()); - -} elseif (!empty($_GET['go']) && $_GET['go'] === 'go') { - // Redirect to the Authorization uri - $url = $harvest->getAuthorizationUri(); - header('Location: ' . $url); -} else { - $url = $currentUri->getRelativeUri() . '?go=go'; - echo "<a href='$url'>Login with Harvest!</a>"; -} diff --git a/vendor/lusitanian/oauth/examples/init.example.php b/vendor/lusitanian/oauth/examples/init.example.php deleted file mode 100644 index fb6aee40..00000000 --- a/vendor/lusitanian/oauth/examples/init.example.php +++ /dev/null @@ -1,136 +0,0 @@ -<?php - -/** - * This file sets up the information needed to test the examples in different environments. - * - * PHP version 5.4 - * - * @author David Desberg <david@daviddesberg.com> - * @author Pieter Hordijk <info@pieterhordijk.com> - * @copyright Copyright (c) 2012 The authors - * @license http://www.opensource.org/licenses/mit-license.html MIT License - */ - -/** - * @var array A list of all the credentials to be used by the different services in the examples - */ -$servicesCredentials = array( - 'amazon' => array( - 'key' => '', - 'secret' => '', - ), - 'bitbucket' => array( - 'key' => '', - 'secret' => '', - ), - 'bitly' => array( - 'key' => '', - 'secret' => '', - ), - 'box' => array( - 'key' => '', - 'secret' => '', - ), - 'buffer' => array( - 'key' => '', - 'secret' => '', - ), - 'dailymotion' => array( - 'key' => '', - 'secret' => '', - ), - 'dropbox' => array( - 'key' => '', - 'secret' => '', - ), - 'etsy' => array( - 'key' => '', - 'secret' => '', - ), - 'facebook' => array( - 'key' => '', - 'secret' => '', - ), - 'fitbit' => array( - 'key' => '', - 'secret' => '', - ), - 'flickr' => array( - 'key' => '', - 'secret' => '', - ), - 'foursquare' => array( - 'key' => '', - 'secret' => '', - ), - 'github' => array( - 'key' => '', - 'secret' => '', - ), - 'google' => array( - 'key' => '', - 'secret' => '', - ), - 'instagram' => array( - 'key' => '', - 'secret' => '', - ), - 'linkedin' => array( - 'key' => '', - 'secret' => '', - ), - 'mailchimp' => array( - 'key' => '', - 'secret' => '', - ), - 'microsoft' => array( - 'key' => '', - 'secret' => '', - ), - 'paypal' => array( - 'key' => '', - 'secret' => '', - ), - 'pocket' => array( - 'key' => '', - ), - 'reddit' => array( - 'key' => '', - 'secret' => '', - ), - 'runkeeper' => array( - 'key' => '', - 'secret' => '', - ), - 'scoopit' => array( - 'key' => '', - 'secret' => '' - ), - 'soundcloud' => array( - 'key' => '', - 'secret' => '', - ), - 'tumblr' => array( - 'key' => '', - 'secret' => '', - ), - 'twitter' => array( - 'key' => '', - 'secret' => '', - ), - 'ustream' => array( - 'key' => '', - 'secret' => '', - ), - 'yahoo' => array( - 'key' => '', - 'secret' => '' - ), - 'yammer' => array( - 'key' => '', - 'secret' => '' - ), -); - -/** @var $serviceFactory \OAuth\ServiceFactory An OAuth service factory. */ -$serviceFactory = new \OAuth\ServiceFactory(); diff --git a/vendor/lusitanian/oauth/examples/instagram.php b/vendor/lusitanian/oauth/examples/instagram.php deleted file mode 100644 index 2e44094c..00000000 --- a/vendor/lusitanian/oauth/examples/instagram.php +++ /dev/null @@ -1,56 +0,0 @@ -<?php - -/** - * Example of retrieving an authentication token of the Instagram service - * - * PHP version 5.4 - * - * @author David Desberg <david@daviddesberg.com> - * @author Pieter Hordijk <info@pieterhordijk.com> - * @author Hannes Van De Vreken <vandevreken.hannes@gmail.com> - * @copyright Copyright (c) 2012 The authors - * @license http://www.opensource.org/licenses/mit-license.html MIT License - */ - -use OAuth\OAuth2\Service\Instagram; -use OAuth\Common\Storage\Session; -use OAuth\Common\Consumer\Credentials; - -/** - * Bootstrap the example - */ -require_once __DIR__ . '/bootstrap.php'; - -// Session storage -$storage = new Session(); - -// Setup the credentials for the requests -$credentials = new Credentials( - $servicesCredentials['instagram']['key'], - $servicesCredentials['instagram']['secret'], - $currentUri->getAbsoluteUri() -); - -$scopes = array('basic', 'comments', 'relationships', 'likes'); - -// Instantiate the Instagram service using the credentials, http client and storage mechanism for the token -/** @var $instagramService Instagram */ -$instagramService = $serviceFactory->createService('instagram', $credentials, $storage, $scopes); - -if (!empty($_GET['code'])) { - // This was a callback request from Instagram, get the token - $instagramService->requestAccessToken($_GET['code']); - - // Send a request with it - $result = json_decode($instagramService->request('users/self'), true); - - // Show some of the resultant data - echo 'Your unique instagram user id is: ' . $result['data']['id'] . ' and your name is ' . $result['data']['full_name']; - -} elseif (!empty($_GET['go']) && $_GET['go'] === 'go') { - $url = $instagramService->getAuthorizationUri(); - header('Location: ' . $url); -} else { - $url = $currentUri->getRelativeUri() . '?go=go'; - echo "<a href='$url'>Login with Instagram!</a>"; -} diff --git a/vendor/lusitanian/oauth/examples/linkedin.php b/vendor/lusitanian/oauth/examples/linkedin.php deleted file mode 100644 index db14ab25..00000000 --- a/vendor/lusitanian/oauth/examples/linkedin.php +++ /dev/null @@ -1,57 +0,0 @@ -<?php - -/** - * Example of retrieving an authentication token of the Linkedin service - * - * PHP version 5.4 - * - * @author David Desberg <david@daviddesberg.com> - * @author Pieter Hordijk <info@pieterhordijk.com> - * @author Antoine Corcy <contact@sbin.dk> - * @copyright Copyright (c) 2012 The authors - * @license http://www.opensource.org/licenses/mit-license.html MIT License - */ - -use OAuth\OAuth2\Service\Linkedin; -use OAuth\Common\Storage\Session; -use OAuth\Common\Consumer\Credentials; - -/** - * Bootstrap the example - */ -require_once __DIR__ . '/bootstrap.php'; - -// Session storage -$storage = new Session(); - -// Setup the credentials for the requests -$credentials = new Credentials( - $servicesCredentials['linkedin']['key'], - $servicesCredentials['linkedin']['secret'], - $currentUri->getAbsoluteUri() -); - -// Instantiate the Linkedin service using the credentials, http client and storage mechanism for the token -/** @var $linkedinService Linkedin */ -$linkedinService = $serviceFactory->createService('linkedin', $credentials, $storage, array('r_basicprofile')); - -if (!empty($_GET['code'])) { - // retrieve the CSRF state parameter - $state = isset($_GET['state']) ? $_GET['state'] : null; - - // This was a callback request from linkedin, get the token - $token = $linkedinService->requestAccessToken($_GET['code'], $state); - - // Send a request with it. Please note that XML is the default format. - $result = json_decode($linkedinService->request('/people/~?format=json'), true); - - // Show some of the resultant data - echo 'Your linkedin first name is ' . $result['firstName'] . ' and your last name is ' . $result['lastName']; - -} elseif (!empty($_GET['go']) && $_GET['go'] === 'go') { - $url = $linkedinService->getAuthorizationUri(); - header('Location: ' . $url); -} else { - $url = $currentUri->getRelativeUri() . '?go=go'; - echo "<a href='$url'>Login with Linkedin!</a>"; -} diff --git a/vendor/lusitanian/oauth/examples/mailchimp.php b/vendor/lusitanian/oauth/examples/mailchimp.php deleted file mode 100644 index dd7e12bd..00000000 --- a/vendor/lusitanian/oauth/examples/mailchimp.php +++ /dev/null @@ -1,55 +0,0 @@ -<?php - -/** - * Example of retrieving an authentication token of the Mailchimp service - * - * PHP version 5.4 - * - * @author David Desberg <david@daviddesberg.com> - * @author Hannes Van De Vreken <vandevreken.hannes@gmail.com> - * @copyright Copyright (c) 2012 The authors - * @license http://www.opensource.org/licenses/mit-license.html MIT License - */ - -use OAuth\OAuth2\Service\Mailchimp; -use OAuth\Common\Storage\Session; -use OAuth\Common\Consumer\Credentials; - -$_SERVER['SERVER_PORT'] = 80; - -/** - * Bootstrap the example - */ -require_once __DIR__ . '/bootstrap.php'; - -// Session storage -$storage = new Session(); - -// Setup the credentials for the requests -$credentials = new Credentials( - $servicesCredentials['mailchimp']['key'], - $servicesCredentials['mailchimp']['secret'], - $currentUri->getAbsoluteUri() -); - -// Instantiate the Mailchimp service using the credentials, http client and storage mechanism for the token -/** @var $mailchimpService Mailchimp */ -$mailchimpService = $serviceFactory->createService('mailchimp', $credentials, $storage, array()); - -if (!empty($_GET['code'])) { - // This was a callback request from mailchimp, get the token - $token = $mailchimpService->requestAccessToken($_GET['code']); - - // Send a request with it - $result = $mailchimpService->request('/users/profile.json'); - - header('Content-Type: application/json'); - echo $result; exit; - -} elseif (!empty($_GET['go']) && $_GET['go'] === 'go') { - $url = $mailchimpService->getAuthorizationUri(); - header('Location: ' . $url); -} else { - $url = $currentUri->getRelativeUri() . '?go=go'; - echo "<a href='$url'>Login with Mailchimp!</a>"; -} diff --git a/vendor/lusitanian/oauth/examples/microsoft.php b/vendor/lusitanian/oauth/examples/microsoft.php deleted file mode 100644 index 1edb13f1..00000000 --- a/vendor/lusitanian/oauth/examples/microsoft.php +++ /dev/null @@ -1,49 +0,0 @@ -<?php - -/** - * Example of retrieving an authentication token of the Microsoft service - * - * PHP version 5.4 - * - * @author David Desberg <david@daviddesberg.com> - * @author Pieter Hordijk <info@pieterhordijk.com> - * @copyright Copyright (c) 2012 The authors - * @license http://www.opensource.org/licenses/mit-license.html MIT License - */ - -use OAuth\OAuth2\Service\Microsoft; -use OAuth\Common\Storage\Session; -use OAuth\Common\Consumer\Credentials; - -/** - * Bootstrap the example - */ -require_once __DIR__ . '/bootstrap.php'; - -// Session storage -$storage = new Session(); - -// Setup the credentials for the requests -$credentials = new Credentials( - $servicesCredentials['microsoft']['key'], - $servicesCredentials['microsoft']['secret'], - $currentUri->getAbsoluteUri() -); - -// Instantiate the Microsoft service using the credentials, http client and storage mechanism for the token -/** @var $microsoft Microsoft */ -$microsoft = $serviceFactory->createService('microsoft', $credentials, $storage, array('basic')); - -if (!empty($_GET['code'])) { - // This was a callback request from Microsoft, get the token - $token = $microsoft->requestAccessToken($_GET['code']); - - var_dump($token); - -} elseif (!empty($_GET['go']) && $_GET['go'] === 'go') { - $url = $microsoft->getAuthorizationUri(); - header('Location: ' . $url); -} else { - $url = $currentUri->getRelativeUri() . '?go=go'; - echo "<a href='$url'>Login with Microsoft!</a>"; -} diff --git a/vendor/lusitanian/oauth/examples/paypal.php b/vendor/lusitanian/oauth/examples/paypal.php deleted file mode 100644 index 207357f2..00000000 --- a/vendor/lusitanian/oauth/examples/paypal.php +++ /dev/null @@ -1,52 +0,0 @@ -<?php - -/** - * Example of retrieving an authentication token of the PayPal service - * - * PHP version 5.4 - * - * @author Flávio Heleno <flaviohbatista@gmail.com> - * @copyright Copyright (c) 2012 The authors - * @license http://www.opensource.org/licenses/mit-license.html MIT License - */ - -use OAuth\OAuth2\Service\Paypal; -use OAuth\Common\Storage\Session; -use OAuth\Common\Consumer\Credentials; - -/** - * Bootstrap the example - */ -require_once __DIR__ . '/bootstrap.php'; - -// Session storage -$storage = new Session(); - -// Setup the credentials for the requests -$credentials = new Credentials( - $servicesCredentials['paypal']['key'], - $servicesCredentials['paypal']['secret'], - $currentUri->getAbsoluteUri() -); - -// Instantiate the PayPal service using the credentials, http client, storage mechanism for the token and profile/openid scopes -/** @var $paypalService PayPal */ -$paypalService = $serviceFactory->createService('paypal', $credentials, $storage, array('profile', 'openid')); - -if (!empty($_GET['code'])) { - // This was a callback request from PayPal, get the token - $token = $paypalService->requestAccessToken($_GET['code']); - - // Send a request with it - $result = json_decode($paypalService->request('/identity/openidconnect/userinfo/?schema=openid'), true); - - // Show some of the resultant data - echo 'Your unique PayPal user id is: ' . $result['user_id'] . ' and your name is ' . $result['name']; - -} elseif (!empty($_GET['go']) && $_GET['go'] === 'go') { - $url = $paypalService->getAuthorizationUri(); - header('Location: ' . $url); -} else { - $url = $currentUri->getRelativeUri() . '?go=go'; - echo "<a href='$url'>Login with PayPal!</a>"; -} diff --git a/vendor/lusitanian/oauth/examples/pocket.php b/vendor/lusitanian/oauth/examples/pocket.php deleted file mode 100644 index b96d2ace..00000000 --- a/vendor/lusitanian/oauth/examples/pocket.php +++ /dev/null @@ -1,63 +0,0 @@ -<?php - -/** - * Example of retrieving an authentication token of the Pocket service. - * - * @author Christian Mayer <thefox21at@gmail.com> - * @copyright Copyright (c) 2014 Christian Mayer <thefox21at@gmail.com> - * @license http://www.opensource.org/licenses/mit-license.html MIT License - */ - -use OAuth\OAuth2\Service\Pocket; -use OAuth\Common\Storage\Session; -use OAuth\Common\Consumer\Credentials; -use OAuth\Common\Http\Client\CurlClient; - -/** - * Bootstrap the example - */ -require_once __DIR__.'/bootstrap.php'; - -$step = isset($_GET['step']) ? (int)$_GET['step'] : null; -$code = isset($_GET['code']) ? $_GET['code'] : null; - -// Session storage -$storage = new Session(); - -// Setup the credentials for the requests -$credentials = new Credentials( - $servicesCredentials['pocket']['key'], - null, // Pocket API doesn't have a secret key. :S - $currentUri->getAbsoluteUri().($code ? '?step=3&code='.$code : '') -); - -// Instantiate the Pocket service using the credentials, http client and storage mechanism for the token -$pocketService = $serviceFactory->createService('Pocket', $credentials, $storage); - -switch($step){ - default: - print '<a href="'.$currentUri->getRelativeUri().'?step=1">Login with Pocket</a>'; - - break; - - case 1: - $code = $pocketService->requestRequestToken(); - header('Location: '.$currentUri->getRelativeUri().'?step=2&code='.$code); - - break; - - case 2: - $url = $pocketService->getAuthorizationUri(array('request_token' => $code)); - header('Location: '.$url); - - break; - - case 3: - $token = $pocketService->requestAccessToken($code); - $accessToken = $token->getAccessToken(); - $extraParams = $token->getExtraParams(); - - print 'User: '.$extraParams['username'].'<br />'; - print 'Access Token: '.$accessToken; - break; -} diff --git a/vendor/lusitanian/oauth/examples/reddit.php b/vendor/lusitanian/oauth/examples/reddit.php deleted file mode 100644 index 7363d840..00000000 --- a/vendor/lusitanian/oauth/examples/reddit.php +++ /dev/null @@ -1,54 +0,0 @@ -<?php - -/** - * Example of retrieving an authentication token of the Reddit service - * - * PHP version 5.4 - * - * @author Connor Hindley <conn.hindley@gmail.com> - * @copyright Copyright (c) 2012 The authors - * @license http://www.opensource.org/licenses/mit-license.html MIT License - */ - -use OAuth\OAuth2\Service\Reddit; -use OAuth\Common\Storage\Session; -use OAuth\Common\Consumer\Credentials; - -/** - * Bootstrap the example - */ -require_once __DIR__ . '/bootstrap.php'; - -// Session storage -$storage = new Session(); - -// Setup the credentials for the requests -$credentials = new Credentials( - $servicesCredentials['reddit']['key'], - $servicesCredentials['reddit']['secret'], - $currentUri->getAbsoluteUri() -); - -// Instantiate the Reddit service using the credentials, http client and storage mechanism for the token -/** @var $reddit Reddit */ -$reddit = $serviceFactory->createService('Reddit', $credentials, $storage, array('identity')); - -if (!empty($_GET['code'])) { - // retrieve the CSRF state parameter - $state = isset($_GET['state']) ? $_GET['state'] : null; - - // This was a callback request from reddit, get the token - $reddit->requestAccessToken($_GET['code'], $state); - - $result = json_decode($reddit->request('api/v1/me.json'), true); - - echo 'Your unique reddit user id is: ' . $result['id'] . ' and your username is ' . $result['name']; - -} elseif (!empty($_GET['go']) && $_GET['go'] === 'go') { - $url = $reddit->getAuthorizationUri(); - header('Location: ' . $url); - -} else { - $url = $currentUri->getRelativeUri() . '?go=go'; - echo "<a href='$url'>Login with Reddit!</a>"; -} diff --git a/vendor/lusitanian/oauth/examples/runkeeper.php b/vendor/lusitanian/oauth/examples/runkeeper.php deleted file mode 100644 index 61a203f9..00000000 --- a/vendor/lusitanian/oauth/examples/runkeeper.php +++ /dev/null @@ -1,51 +0,0 @@ -<?php - -/** - * Example of retrieving an authentication token from the RunKeeper service - * - * PHP version 5.4 - * - * @copyright Copyright (c) 2012 The authors - * @license http://www.opensource.org/licenses/mit-license.html MIT License - */ - -use OAuth\OAuth2\Service\RunKeeper; -use OAuth\Common\Storage\Session; -use OAuth\Common\Consumer\Credentials; - -/** - * Bootstrap the example - */ -require_once __DIR__ . '/bootstrap.php'; - -// Session storage -$storage = new Session(); - -// Setup the credentials for the requests -$credentials = new Credentials( - $servicesCredentials['runkeeper']['key'], - $servicesCredentials['runkeeper']['secret'], - $currentUri->getAbsoluteUri() -); - -// Instantiate the Runkeeper service using the credentials, http client and storage mechanism for the token -/** @var $runkeeperService RunKeeper */ -$runkeeperService = $serviceFactory->createService('RunKeeper', $credentials, $storage, array()); - -if (!empty($_GET['code'])) { - // This was a callback request from RunKeeper, get the token - $token = $runkeeperService->requestAccessToken($_GET['code']); - - // Send a request with it - $result = json_decode($runkeeperService->request('/user'), true); - - // Show some of the resultant data - echo 'Your unique RunKeeper user id is: ' . $result['userID']; - -} elseif (!empty($_GET['go']) && $_GET['go'] === 'go') { - $url = $runkeeperService->getAuthorizationUri(); - header('Location: ' . $url); -} else { - $url = $currentUri->getRelativeUri() . '?go=go'; - echo "<a href='$url'>Login with RunKeeper!</a>"; -} diff --git a/vendor/lusitanian/oauth/examples/scoopit.php b/vendor/lusitanian/oauth/examples/scoopit.php deleted file mode 100644 index cc1c103b..00000000 --- a/vendor/lusitanian/oauth/examples/scoopit.php +++ /dev/null @@ -1,57 +0,0 @@ -<?php - -/** - * Example of making API calls for the ScoopIt service - * - * @author Pieter Hordijk <info@pieterhordijk.com> - * @copyright Copyright (c) 2013 The authors - * @license http://www.opensource.org/licenses/mit-license.html MIT License - */ - -use OAuth\OAuth1\Service\ScoopIt; -use OAuth\Common\Storage\Session; -use OAuth\Common\Consumer\Credentials; - -/** - * Bootstrap the example - */ -require_once __DIR__.'/bootstrap.php'; - -// Session storage -$storage = new Session(); - -// Setup the credentials for the requests -$credentials = new Credentials( - $servicesCredentials['scoopit']['key'], - $servicesCredentials['scoopit']['secret'], - $currentUri->getAbsoluteUri() -); - -// Instantiate the ScoopIt service using the credentials, http client and storage mechanism for the token -$scoopItService = $serviceFactory->createService('ScoopIt', $credentials, $storage); - -if (!empty($_GET['oauth_token'])) { - $token = $storage->retrieveAccessToken('ScoopIt'); - - // This was a callback request from ScoopIt, get the token - $scoopItService->requestAccessToken( - $_GET['oauth_token'], - $_GET['oauth_verifier'], - $token->getRequestTokenSecret() - ); - - // Send a request now that we have access token - $result = json_decode($scoopItService->request('profile')); - - echo 'result: <pre>' . print_r($result, true) . '</pre>'; - -} elseif (!empty($_GET['go']) && $_GET['go'] === 'go') { - // extra request needed for oauth1 to request a request token :-) - $token = $scoopItService->requestRequestToken(); - - $url = $scoopItService->getAuthorizationUri(array('oauth_token' => $token->getRequestToken())); - header('Location: ' . $url); -} else { - $url = $currentUri->getRelativeUri() . '?go=go'; - echo "<a href='$url'>Login with ScoopIt!</a>"; -} diff --git a/vendor/lusitanian/oauth/examples/soundcloud.php b/vendor/lusitanian/oauth/examples/soundcloud.php deleted file mode 100644 index 2629490b..00000000 --- a/vendor/lusitanian/oauth/examples/soundcloud.php +++ /dev/null @@ -1,53 +0,0 @@ -<?php - -/** - * Example of retrieving an authentication token of the SoundCloud service - * - * PHP version 5.4 - * - * @author David Desberg <david@daviddesberg.com> - * @author Pieter Hordijk <info@pieterhordijk.com> - * @copyright Copyright (c) 2012 The authors - * @license http://www.opensource.org/licenses/mit-license.html MIT License - */ - -use OAuth\OAuth2\Service\SoundCloud; -use OAuth\Common\Storage\Session; -use OAuth\Common\Consumer\Credentials; - -/** - * Bootstrap the example - */ -require_once __DIR__ . '/bootstrap.php'; - -// Session storage -$storage = new Session(); - -// Setup the credentials for the requests -$credentials = new Credentials( - $servicesCredentials['soundcloud']['key'], - $servicesCredentials['soundcloud']['secret'], - $currentUri->getAbsoluteUri() -); - -// Instantiate the SoundCloud service using the credentials, http client and storage mechanism for the token -/** @var $soundcloudService SoundCloud */ -$soundcloudService = $serviceFactory->createService('soundCloud', $credentials, $storage); - -if (!empty($_GET['code'])) { - // This was a callback request from SoundCloud, get the token - $soundcloudService->requestAccessToken($_GET['code']); - - // Send a request with it - $result = json_decode($soundcloudService->request('me.json'), true); - - // Show some of the resultant data - echo 'Your unique user id is: ' . $result['id'] . ' and your name is ' . $result['username']; - -} elseif (!empty($_GET['go']) && $_GET['go'] === 'go') { - $url = $soundcloudService->getAuthorizationUri(); - header('Location: ' . $url); -} else { - $url = $currentUri->getRelativeUri() . '?go=go'; - echo "<a href='$url'>Login with SoundCloud!</a>"; -} diff --git a/vendor/lusitanian/oauth/examples/tumblr.php b/vendor/lusitanian/oauth/examples/tumblr.php deleted file mode 100644 index bde0521b..00000000 --- a/vendor/lusitanian/oauth/examples/tumblr.php +++ /dev/null @@ -1,62 +0,0 @@ -<?php - -/** - * Example of retrieving an authentication token of the Tumblr service - * - * PHP version 5.4 - * - * @author David Desberg <david@daviddesberg.com> - * @author Pieter Hordijk <info@pieterhordijk.com> - * @copyright Copyright (c) 2012 The authors - * @license http://www.opensource.org/licenses/mit-license.html MIT License - */ - -use OAuth\OAuth1\Service\Tumblr; -use OAuth\Common\Storage\Session; -use OAuth\Common\Consumer\Credentials; - -/** - * Bootstrap the example - */ -require_once __DIR__ . '/bootstrap.php'; - -// We need to use a persistent storage to save the token, because oauth1 requires the token secret received before' -// the redirect (request token request) in the access token request. -$storage = new Session(); - -// Setup the credentials for the requests -$credentials = new Credentials( - $servicesCredentials['tumblr']['key'], - $servicesCredentials['tumblr']['secret'], - $currentUri->getAbsoluteUri() -); - -// Instantiate the tumblr service using the credentials, http client and storage mechanism for the token -/** @var $tumblrService Tumblr */ -$tumblrService = $serviceFactory->createService('tumblr', $credentials, $storage); - -if (!empty($_GET['oauth_token'])) { - $token = $storage->retrieveAccessToken('Tumblr'); - - // This was a callback request from tumblr, get the token - $tumblrService->requestAccessToken( - $_GET['oauth_token'], - $_GET['oauth_verifier'], - $token->getRequestTokenSecret() - ); - - // Send a request now that we have access token - $result = json_decode($tumblrService->request('user/info')); - - echo 'result: <pre>' . print_r($result, true) . '</pre>'; - -} elseif (!empty($_GET['go']) && $_GET['go'] === 'go') { - // extra request needed for oauth1 to request a request token :-) - $token = $tumblrService->requestRequestToken(); - - $url = $tumblrService->getAuthorizationUri(array('oauth_token' => $token->getRequestToken())); - header('Location: ' . $url); -} else { - $url = $currentUri->getRelativeUri() . '?go=go'; - echo "<a href='$url'>Login with Tumblr!</a>"; -} diff --git a/vendor/lusitanian/oauth/examples/twitter.php b/vendor/lusitanian/oauth/examples/twitter.php deleted file mode 100644 index 6b14a222..00000000 --- a/vendor/lusitanian/oauth/examples/twitter.php +++ /dev/null @@ -1,62 +0,0 @@ -<?php - -/** - * Example of retrieving an authentication token of the Twitter service - * - * PHP version 5.4 - * - * @author David Desberg <david@daviddesberg.com> - * @author Pieter Hordijk <info@pieterhordijk.com> - * @copyright Copyright (c) 2012 The authors - * @license http://www.opensource.org/licenses/mit-license.html MIT License - */ - -use OAuth\OAuth1\Service\Twitter; -use OAuth\Common\Storage\Session; -use OAuth\Common\Consumer\Credentials; - -/** - * Bootstrap the example - */ -require_once __DIR__ . '/bootstrap.php'; - -// We need to use a persistent storage to save the token, because oauth1 requires the token secret received before' -// the redirect (request token request) in the access token request. -$storage = new Session(); - -// Setup the credentials for the requests -$credentials = new Credentials( - $servicesCredentials['twitter']['key'], - $servicesCredentials['twitter']['secret'], - $currentUri->getAbsoluteUri() -); - -// Instantiate the twitter service using the credentials, http client and storage mechanism for the token -/** @var $twitterService Twitter */ -$twitterService = $serviceFactory->createService('twitter', $credentials, $storage); - -if (!empty($_GET['oauth_token'])) { - $token = $storage->retrieveAccessToken('Twitter'); - - // This was a callback request from twitter, get the token - $twitterService->requestAccessToken( - $_GET['oauth_token'], - $_GET['oauth_verifier'], - $token->getRequestTokenSecret() - ); - - // Send a request now that we have access token - $result = json_decode($twitterService->request('account/verify_credentials.json')); - - echo 'result: <pre>' . print_r($result, true) . '</pre>'; - -} elseif (!empty($_GET['go']) && $_GET['go'] === 'go') { - // extra request needed for oauth1 to request a request token :-) - $token = $twitterService->requestRequestToken(); - - $url = $twitterService->getAuthorizationUri(array('oauth_token' => $token->getRequestToken())); - header('Location: ' . $url); -} else { - $url = $currentUri->getRelativeUri() . '?go=go'; - echo "<a href='$url'>Login with Twitter!</a>"; -} diff --git a/vendor/lusitanian/oauth/examples/ustream.php b/vendor/lusitanian/oauth/examples/ustream.php deleted file mode 100644 index e3ca0bb4..00000000 --- a/vendor/lusitanian/oauth/examples/ustream.php +++ /dev/null @@ -1,54 +0,0 @@ -<?php - -/** - * Example of retrieving an authentication token of the Ustream service - * - * PHP version 5.4 - * - * @author Attila Gonda <pcdevil7@gmail.com> - * @copyright Copyright (c) 2014 The authors - * @license http://www.opensource.org/licenses/mit-license.html MIT License - */ - -use OAuth\OAuth2\Service\Ustream; -use OAuth\Common\Storage\Session; -use OAuth\Common\Consumer\Credentials; - -/** - * Bootstrap the example - */ -require_once __DIR__ . '/bootstrap.php'; - -// Session storage -$storage = new Session(); - -// Setup the credentials for the requests -$credentials = new Credentials( - $servicesCredentials['ustream']['key'], - $servicesCredentials['ustream']['secret'], - $currentUri->getAbsoluteUri() -); - -// Instantiate the Ustream service using the credentials, http client and storage mechanism for the token -/** @var $ustream Ustream */ -$ustream = $serviceFactory->createService('Ustream', $credentials, $storage, array('identity')); - -if (!empty($_GET['code'])) { - // retrieve the CSRF state parameter - $state = isset($_GET['state']) ? $_GET['state'] : null; - - // This was a callback request from Ustream, get the token - $ustream->requestAccessToken($_GET['code'], $state); - - $result = json_decode($ustream->request('users/self.json'), true); - - echo 'Your unique Ustream user id is: ' . $result['id'] . ' and your username is ' . $result['username']; - -} elseif (!empty($_GET['go']) && $_GET['go'] === 'go') { - $url = $ustream->getAuthorizationUri(); - header('Location: ' . $url); - -} else { - $url = $currentUri->getRelativeUri() . '?go=go'; - echo "<a href='$url'>Login with Ustream!</a>"; -} diff --git a/vendor/lusitanian/oauth/examples/yahoo.php b/vendor/lusitanian/oauth/examples/yahoo.php deleted file mode 100644 index 549332e9..00000000 --- a/vendor/lusitanian/oauth/examples/yahoo.php +++ /dev/null @@ -1,57 +0,0 @@ -<?php - -/** - * Example of making API calls for the Yahoo service - * - * @author Pieter Hordijk <info@pieterhordijk.com> - * @copyright Copyright (c) 2014 The authors - * @license http://www.opensource.org/licenses/mit-license.html MIT License - */ - -use OAuth\OAuth1\Service\Yahoo; -use OAuth\Common\Storage\Session; -use OAuth\Common\Consumer\Credentials; - -/** - * Bootstrap the example - */ -require_once __DIR__.'/bootstrap.php'; - -// Session storage -$storage = new Session(); - -// Setup the credentials for the requests -$credentials = new Credentials( - $servicesCredentials['yahoo']['key'], - $servicesCredentials['yahoo']['secret'], - $currentUri->getAbsoluteUri() -); - -// Instantiate the Yahoo service using the credentials, http client and storage mechanism for the token -$yahooService = $serviceFactory->createService('Yahoo', $credentials, $storage); - -if (!empty($_GET['oauth_token'])) { - $token = $storage->retrieveAccessToken('Yahoo'); - - // This was a callback request from Yahoo, get the token - $yahooService->requestAccessToken( - $_GET['oauth_token'], - $_GET['oauth_verifier'], - $token->getRequestTokenSecret() - ); - - // Send a request now that we have access token - $result = json_decode($yahooService->request('profile')); - - echo 'result: <pre>' . print_r($result, true) . '</pre>'; - -} elseif (!empty($_GET['go']) && $_GET['go'] === 'go') { - // extra request needed for oauth1 to request a request token :-) - $token = $yahooService->requestRequestToken(); - - $url = $yahooService->getAuthorizationUri(array('oauth_token' => $token->getRequestToken())); - header('Location: ' . $url); -} else { - $url = $currentUri->getRelativeUri() . '?go=go'; - echo "<a href='$url'>Login with Yahoo!</a>"; -} |