• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Node social
 

Node social

on

  • 2,380 views

Social networks integration using node js: ...

Social networks integration using node js:
1. OAuth2
2. API consumption
3. everyauth vs. passport.js

the demo code can be found under my github repo - https://github.com/orkaplan/social-demo

Statistics

Views

Total Views
2,380
Views on SlideShare
2,380
Embed Views
0

Actions

Likes
2
Downloads
8
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Node social Node social Presentation Transcript

    • • An authentication & authorization standard against third party REST services• Set a list of permission to access data and perform actions: • Read user data • Write to user data • Delete user data • Get user Location• At the end of the process an access_token is obtained
    • Implementation example for Facebook
    • Implementation example for Facebook
    • • You don’t have to implement your own authentication mechanism• Save the security headache• Save development time• Use OAuth for 3rd party services to provide the authentication mechanism for the product.• Get access token and use it to fetch basic details about the user.• Examples: • Asana leverages Google authentication in addition to its service. • For Android use Google ID (google play API). • Social plugins for Wordpress.
    • everyauth .facebook .appId(conf.fb.appId) .appSecret(conf.fb.appSecret) .findOrCreateUser( function (session, accessToken, accessTokenExtra,fbUserMetadata) { return this.promise(); var user = usersByFbId[fbUserMetadata.id] || (usersByFbId[fbUserMetadata.id] = addUser(facebook, fbUserMetadata)); promise.fulfill(user); }) .redirectPath(/);
    • https://graph.facebook.com/mike.shaver/picturehttps://graph.facebook.com/mike.shaver/picture{ "data": { "data": { "url": "https://fbcdn-profile-a.akamaihd.net/hprofile-ak-ash4/372183_100002526091955_998385602_q.jpg", "url": "https://fbcdn-profile-a.akamaihd.net/hprofile-ak-ash4/372183_100002526091955_998385602_q.jpg", "is_silhouette": false } "is_silhouette": false } }}
    • var baseUrl = "https://graph.facebook.com/";var url = userId + "/likes";var params = {access_token: accessToken};request({ method: GET, url:baseUrl + url, qs: params, json: true }, function (err, res, body) { if (err) return callback(err); if (!res || res.statusCode != 200) return callback({message: "invalidstatus code" + (res && res.statusCode) , body: body}); return callback(null, body); } );
    • var fbapi = require(facebook-api);var client = fbapi.user(user.accessToken); client.me.friends(function (err, friends) { res.render(account, { user: user, friends: friends}); });
    • https://github.com/orkaplan/social-demo