dev-master
9999999-devAuthorize users in your application with multiple OAuth 1.0 providers
dbad-license
The Requires
- php >=5.3.0
- guzzle/guzzle 3.3.*
The Development Requires
by Chris Harvey
authentication authorization oauth providers
Authorize users in your application with multiple OAuth 1.0 providers
Deprecated: Use league/oauth1-client., (*1)
Authorize users with your application using multiple OAuth 1 providers., (*2)
In this example we will authenticate the user using Twitter., (*3)
session_start(); $oauth = new \OAuth1\Provider\Twitter(array( 'id' => 'CLIENT_ID', 'secret' => 'CLIENT_SECRET', 'redirect_url' => 'URL_TO_THIS_PAGE' )); if ($oauth->isCallback()) { $oauth->validateCallback(unserialize($_SESSION['token'])) } else { $token = $oauth->requestToken(); $_SESSION['token'] = serialize($token); $url = $oauth->authorize($token); header("Location: {$url}"); exit; } // Tokens print_r($oauth->getUserTokens()); // User data print_r($oauth->getUserInfo());
If all goes well you should see a dump of the users tokens and data., (*4)
You can also use this package to make calls to your respective APIs using Guzzle., (*5)
$client = new \OAuth1\Client('http://api.twitter.com/1.1'); $client->setProvider($oauth) ->setUserTokens($oauth->getUserTokens()); echo $client->get('statuses/mentions_timeline.json')->send();
This example should show your Twitter mentions from the API along with the headers, (*6)
develop
branch (or branch off of it)Authorize users in your application with multiple OAuth 1.0 providers
dbad-license
authentication authorization oauth providers