Releases: sudocode/ohmy-auth
Legs, Sessions, Components, and Bulk Sets
You can now create new OAuth flows using the legs() function. In addition, you can pass an array to the set() function to set multiple keys/values:
use ohmy\Auth1;
$twitter = Auth1::legs(2)
->set(array(
'key' => 'foo',
'secret' => 'bar',
'callback' => 'localhost:3000/'
))
->request('https://api.twitter.com/oauth/request_token')
->authorize('https://api.twitter.com/oauth/authorize')
->access('https://api.twitter.com/oauth/access_token');
Also, you no longer need to explicitly call session_start / session_destroy. Sessions are now handled by a special class under ohmy\Components\Session
.
By default, the PHPSession will be used. If you want to use MySQL sessions instead, simply create a class that implements the interface found in ohmy\Components\Session.php
. Then pass an object of your new class via the override method. You can also override the default Curl class with your own HTTP client object that implements ohmy\Components\Http.php
.
use ohmy\Auth1;
Auth1::legs(2)
->set(array(
'key' => 'foo',
'secret' => 'bar',
'callback' => 'localhost:3000/'
))
->override('session', $myCustomSessionObject)
->override('http', $myCustomHttpObject);
Enjoy the new release, and please provide any feedback. I plan to add the ability to refresh tokens, reuse old tokens, custom exceptions, better documentation, and more unit tests in future releases.
Official support for PHP 5.3
Merge pull request #6 from sudocode/php-53 Added official support PHP5.3
Authentication can now be restored from a saved token/secret
0.0.5 fixed curl test
Added support for Google+, Instagram, and Microsoft Live
0.0.4 Update README.md
Facebook, Fitbit, LinkedIn, and Yahoo!
ohmy-auth now works with Facebook, Fitbit, LinkedIn, and Yahoo!
0.0.2
Introducing ohmy-auth!
ohmy-auth is an OAuth 1.0a/2.0 convenience library that leverages promises to simplify OAuth into a series of chained function calls:
Auth1::init(2)
->set('oauth_consumer_key', 'key')
->set('oauth_consumer_secret', 'secret')
->request($request_token_url)
->access($access_token_url)
->GET($api_url)
->then(function($data) {
# got data
});
Oma allows a developer to step in at any time of the OAuth flow to inspect and manipulate data. For example, you could chain a then()
after an access()
call to store your access token into a database.
So far it works with GitHub, Twitter, and Tumblr. Check out the examples for sample code. And stay tuned for more updates!