0.0.5 • Published 10 years ago

slogin v0.0.5

Weekly downloads
3
License
WTFPL
Repository
github
Last release
10 years ago

##Welcome to slogin

slogin module allows to get users information from the social network like Facebook, Github, Gmail and etc. Currently it only support Facebook and Github.

##Installation

npm install slogin

##Quick Start

slogin module require app(client) id, secret (consumer) key, redirect url and network proxy (optional). Regester your application on facebook( Click here ), on github( Click here ) in order to get client id and secret key.

//  Facebook authentication
var provider = "facebook",
    options = {
	    clientID: "Add facebook clientID",
	    secretKey: "Add facebook secret key",
	    redirectURL: "Add redirect url"
    },
    proxy="";

//Initialization facebook objects... .. .
var fb = require('slogin').oauth(provider, options, proxy);    

//Initialization github objects... .. .
var git = require('slogin').oauth(provider, options, proxy);    

// Get facebook login url and redirect it for user authentication 
fb.getLogin(function(err, url){
	if(!err){
		 // Please add your code that make a request using facebook login url 
	}
});

// Get github login url and redirect it for user authentication 
git.getLogin(function(err, url){
	if(!err){
		 // Please add your code that make a request using facebook login url 
	}
});

Above code will ask user to enter his credentials and if user enter correct credentials then fb callback to redirect url with unique code as a query parameter. This unique code is require to get user info.

Once you get user code, follow below code to get user details

//get fecebook user details
fb.getUserDetails(code, function(err, userDetails){
	console.dir(userDetails);
});

//get github user details
fb.getUserDetails(code, function(err, userDetails){
	console.dir(userDetails);
});
0.0.5

10 years ago

0.0.4

10 years ago

0.0.3

10 years ago

0.0.2

10 years ago

0.0.1

10 years ago