Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bitliner/fauthentication
Node module to integrate your Node app with Facebook oauth authentication
https://github.com/bitliner/fauthentication
Last synced: about 21 hours ago
JSON representation
Node module to integrate your Node app with Facebook oauth authentication
- Host: GitHub
- URL: https://github.com/bitliner/fauthentication
- Owner: bitliner
- Created: 2012-09-15T00:21:54.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2012-09-15T03:59:14.000Z (over 12 years ago)
- Last Synced: 2024-12-29T06:19:21.937Z (26 days ago)
- Language: JavaScript
- Size: 474 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: Readme.md
Awesome Lists containing this project
README
# FAuthentication
Node.js module to integrate quickly your Node app with Facebook OAuth authentication
## How to use it
### 1. create your Facebook app on [Facebook Developers](https://developers.facebook.com/apps)
### 2. install FAuthentication
```js
npm install fauthentication
```### 3. specify settings for FAuthentication (with settings of your Facebook app)
```js
/* import fauthentication */var fauthentication=require('fauthentication')
/* set FAuthentication's options (parameters of Facebook app and callbacks) */
fauthentication.settings({
client_id: 'your-app-id',
client_secret: 'your-app-secret',
redirect_uri: 'http://your-site-domain:your-port/fauthentication/getAccessToken',
app: app,
callback: function(accessToken){console.log('now you have access token',accessToken);
fauthentication.getUser(function(user){
console.log('Facebook user data',user);
// here you can save user, log in...
})}
})
```### 4. bind the urls of your application with FAuthentication's request handlers
```js
/* set FAuthentication's url*/
app.get('/fauthentication/authenticate',fauthentication.auth)
app.get('/fauthentication/getAccessToken',fauthentication.getAccessToken) /* this must be according to `redirect_uri` settings (see above) */```
### 5. In your login page insert a button to login and corresponding javascript function to open Facebook dialog box
```html
...
var login=function(){
window.open('/fauthentication/authenticate?next=/', 'Facebook Login', 'width=300px, height=300');
}
Facebook Login...
```
## Try with examples
```
git clone [email protected]:bitliner/FAuthentication.git fauthenticationcd fauthentication/examples/fauthentication-with-express
npm install
node app.js
// now in your browser go to http://localhost:3000/
```