chrisnharvey / oauth1
Authorize users in your application with multiple OAuth 1.0 providers
Installs: 8 515
Dependents: 1
Suggesters: 0
Security: 0
Stars: 1
Watchers: 3
Forks: 4
Open Issues: 1
Requires
- php: >=5.3.0
- guzzle/guzzle: 3.3.*
Requires (Dev)
- mockery/mockery: 0.7.*
- phpunit/phpunit: 3.7.*
This package is auto-updated.
Last update: 2024-11-16 09:54:39 UTC
README
Deprecated: Use league/oauth1-client.
Authorize users with your application using multiple OAuth 1 providers.
Supported Providers
- Dropbox
- Flickr
- Tumblr
- UbuntuOne
- Vimeo
Usage Example
In this example we will authenticate the user using Twitter.
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.
Calling OAuth 1 APIs using Guzzle
You can also use this package to make calls to your respective APIs using Guzzle.
$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
Contribute
- Check for open issues or open a new issue for a feature request or a bug
- Fork the repository on Github to start making your changes to the
develop
branch (or branch off of it) - Write a test which shows that the bug was fixed or that the feature works as expected
- Send a pull request and bug me until I merge it