2. Why need open authentication?
● This process will give a life to users who come on your app
but don't want to see a large size registration form
● Every user will try your app by simply doing the one click
registration/login
● Thus It will give a large number of users to your
application
● Your app will be social on internet via these users
permissions
● This is smart and modern at a glance
3. How it can be done?
Using OAuth2.0 Using lib/class of
individual web
● Very easy to use in your app services
● Supports major social
network's authentication
flow ● Using twitteroauth for
● facebook, Google, LinkedIn, implementing
Windows Live ... [authentication by
● Doesn't supports twiiter]
Twitter: https://dev.twitter. ● Any other web service's
com/discussions/397
API
5. Three different steps:
user authentication
User authentication ensures that the user is who they say they are
app authorization
App authorization ensures that the user knows exactly what data and
capabilities they are providing to your app
Need: app_id, redirect_uri
app authentication
App authentication ensures that the user is giving their information to
your
app and not someone else
Need: authorization_code, app_secret, redirect_uri
6. For knowing about OAuth2.0
http://hueniverse.com/2010/05/introducing-oauth-2-0/
7. Authentication Using OAuth2.0
1. Download OAuth2.0 from here: http://raynux.
com/ray/labs/projects/oauth2.zip
2. Configure [config.php] according to services you want to
implement in your app for authentication
OAuth2Consumer::getInstance('Facebook', array(
'client_id' => '...........',
'client_secret' => '...........',
3. Use the authorization method in any link/button any where
OAuth2Consumer::getInstance('Facebook')
->authorize();
4. Use any method for example grabbing access token,
$oauth = OAuth2Consumer::getInstance('Facebook');
$accessToken = $oauth->getAccessToken();
Or getting user data etc
$friends = $oauth->api('me/friendlists');
8. Using API of Individual WebSr Ex basic auth by twitter
1. To get/create [consumer key], [consumer secret] and for
basic app URL setup go here: https://dev.twitter.com/apps
2. Get [twitteroauth.php] and [OAuth.php] by downloading
twitter recommended example for PHP app from here: https:
//github.com/abraham/twitteroauth/
3. To Get [oauth_token], [oauth_token_secret]
$twitteroauth = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET);
$request_token = $twitteroauth
->getRequestToken('TWITTER_CALLBACK_URL');
4. Then to get [access_token] using [oauth_verifier]
$twitteroauth = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET,
[oauth_token], [oauth_token_secret]);
$access_token = $twitteroauth->getAccessToken($_GET['oauth_verifier']);
9. continue ...
5. For getting user data:
$userInfo = $twitteroauth->get('account/verify_credentials');