fruitstand
Version:
56 lines (55 loc) • 6.56 kB
JSON
{
"name": "passport-facebook",
"version": "1.0.3",
"description": "Facebook authentication strategy for Passport.",
"keywords": [
"passport",
"facebook",
"auth",
"authn",
"authentication",
"identity"
],
"author": {
"name": "Jared Hanson",
"email": "jaredhanson@gmail.com",
"url": "http://www.jaredhanson.net/"
},
"repository": {
"type": "git",
"url": "git://github.com/jaredhanson/passport-facebook.git"
},
"bugs": {
"url": "http://github.com/jaredhanson/passport-facebook/issues"
},
"licenses": [
{
"type": "MIT",
"url": "http://www.opensource.org/licenses/MIT"
}
],
"main": "./lib",
"dependencies": {
"passport-oauth2": "1.x.x"
},
"devDependencies": {
"mocha": "1.x.x",
"chai": "1.x.x",
"chai-passport-strategy": "0.2.x"
},
"engines": {
"node": ">= 0.4.0"
},
"scripts": {
"test": "node_modules/.bin/mocha --reporter spec --require test/bootstrap/node test/*.test.js"
},
"readme": "# passport-facebook\n\n[](https://travis-ci.org/jaredhanson/passport-facebook)\n[](https://coveralls.io/r/jaredhanson/passport-facebook)\n[](https://codeclimate.com/github/jaredhanson/passport-facebook)\n[](https://david-dm.org/jaredhanson/passport-facebook)\n[](https://www.gittip.com/jaredhanson/)\n\n[Passport](http://passportjs.org/) strategy for authenticating with [Facebook](http://www.facebook.com/)\nusing the OAuth 2.0 API.\n\nThis module lets you authenticate using Facebook in your Node.js applications.\nBy plugging into Passport, Facebook authentication can be easily and\nunobtrusively integrated into any application or framework that supports\n[Connect](http://www.senchalabs.org/connect/)-style middleware, including\n[Express](http://expressjs.com/).\n\n## Install\n\n $ npm install passport-facebook\n\n## Usage\n\n#### Configure Strategy\n\nThe Facebook authentication strategy authenticates users using a Facebook\naccount and OAuth 2.0 tokens. The strategy requires a `verify` callback, which\naccepts these credentials and calls `done` providing a user, as well as\n`options` specifying a app ID, app secret, and callback URL.\n\n passport.use(new FacebookStrategy({\n clientID: FACEBOOK_APP_ID,\n clientSecret: FACEBOOK_APP_SECRET,\n callbackURL: \"http://localhost:3000/auth/facebook/callback\"\n },\n function(accessToken, refreshToken, profile, done) {\n User.findOrCreate({ facebookId: profile.id }, function (err, user) {\n return done(err, user);\n });\n }\n ));\n\n#### Authenticate Requests\n\nUse `passport.authenticate()`, specifying the `'facebook'` strategy, to\nauthenticate requests.\n\nFor example, as route middleware in an [Express](http://expressjs.com/)\napplication:\n\n app.get('/auth/facebook',\n passport.authenticate('facebook'));\n\n app.get('/auth/facebook/callback',\n passport.authenticate('facebook', { failureRedirect: '/login' }),\n function(req, res) {\n // Successful authentication, redirect home.\n res.redirect('/');\n });\n\n#### Extended Permissions\n\nIf you need extended permissions from the user, the permissions can be requested\nvia the `scope` option to `passport.authenticate()`.\n\nFor example, this authorization requests permission to the user's statuses and\ncheckins:\n\n app.get('/auth/facebook',\n passport.authenticate('facebook', { scope: ['user_status', 'user_checkins'] }));\n\n#### Display Mode\n\nThe display mode with which to render the authorization dialog can be set by\nspecifying the `display` option. Refer to Facebook's [OAuth Dialog](https://developers.facebook.com/docs/reference/dialogs/oauth/)\ndocumentation for more information.\n\n app.get('/auth/facebook',\n passport.authenticate('facebook', { display: 'touch' }));\n\n#### Profile Fields\n\nThe Facebook profile is very rich, and may contain a lot of information. The\nstrategy can be configured with a `profileFields` parameter which specifies a\nlist of fields (named by Portable Contacts convention) your application needs.\nFor example, to fetch only user's facebook ID, name, and picture, configure\nstrategy like this.\n\n passport.use(new FacebookStrategy({\n // clientID, clientSecret and callbackURL\n profileFields: ['id', 'displayName', 'photos']\n },\n // verify callback\n ));\n\nIf `profileFields` is not specified, the default fields supplied by Facebook\nwill be parsed.\n\n## Examples\n\nFor a complete, working example, refer to the [login example](https://github.com/jaredhanson/passport-facebook/tree/master/examples/login).\n\n## Issues\n\nFacebook's OAuth 2.0 implementation has a [bug][1] in which the fragment `#_=_`\nis appended to the callback URL. This appears to affect Firefox and Chrome, but\nnot Safari. This fragment can be removed via client-side JavaScript, and [@niftylettuce](https://github.com/niftylettuce)\nprovides a suggested [workaround][2]. Developers are encouraged to direct their\ncomplaints to Facebook in an effort to get them to implement a proper fix for\nthis issue.\n[1]: https://developers.facebook.com/bugs/196125357123225\n[2]: https://github.com/jaredhanson/passport-facebook/issues/12#issuecomment-5913711\n\n## Related Modules\n\n- [passport-facebook-canvas](https://github.com/missinglink/passport-facebook-canvas) — authentication for apps on Facebook Canvas\n- [passport-facebook-token](https://github.com/drudge/passport-facebook-token) — authenticate tokens issued to devices (iOS, Android, etc.)\n\n## Tests\n\n $ npm install\n $ npm test\n\n## Credits\n\n - [Jared Hanson](http://github.com/jaredhanson)\n\n## License\n\n[The MIT License](http://opensource.org/licenses/MIT)\n\nCopyright (c) 2011-2014 Jared Hanson <[http://jaredhanson.net/](http://jaredhanson.net/)>\n",
"readmeFilename": "README.md",
"homepage": "https://github.com/jaredhanson/passport-facebook",
"_id": "passport-facebook@1.0.3",
"dist": {
"shasum": "98c75b72f7ecfbca6cf47e78540e71b1fe9c96b2"
},
"_from": "passport-facebook@",
"_resolved": "https://registry.npmjs.org/passport-facebook/-/passport-facebook-1.0.3.tgz"
}