Implementing open authentication_in_your_app

1,148 views
1,080 views

Published on

Office Weekly Session

Published in: Technology
0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,148
On SlideShare
0
From Embeds
0
Number of Embeds
5
Actions
Shares
0
Downloads
25
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide

Implementing open authentication_in_your_app

  1. 1. Implementing OpenAuthentication in your App OAuth2.0 / Individual OAuth Service [Offices Weekly Session] @ WNeeds.com
  2. 2. Why need open authentication?● This process will give a life to users who come on your app but dont 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. 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 networks authentication flow ● Using twitteroauth for ● facebook, Google, LinkedIn, implementing Windows Live ... [authentication by ● Doesnt supports twiiter] Twitter: https://dev.twitter. ●  Any other web services com/discussions/397 API
  4. 4. Standard work flow of any of these 
  5. 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. 6. For knowing about OAuth2.0http://hueniverse.com/2010/05/introducing-oauth-2-0/
  7. 7. Authentication Using OAuth2.01. Download OAuth2.0 from here: http://raynux.com/ray/labs/projects/oauth2.zip2. Configure [config.php] according to services you want toimplement 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. 8. Using API of Individual WebSr Ex basic auth by twitter1. To get/create [consumer key], [consumer secret] and forbasic app URL setup go here: https://dev.twitter.com/apps2. Get [twitteroauth.php] and [OAuth.php] by downloadingtwitter 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. 9. continue ...5. For getting user data:    $userInfo = $twitteroauth->get(account/verify_credentials);
  10. 10. Lets Discuss

×