Permalink
Browse files

Merge pull request #149 from gimenete/patch-1

More syntax highlighting in README.md
  • Loading branch information...
2 parents 3566226 + 1979aa5 commit 3c5155f30cb78cb6dbab4d9cf0f3bd9bbf5cb0fc @jaredhanson committed Feb 2, 2016
Showing with 24 additions and 20 deletions.
  1. +24 −20 README.md
View
@@ -40,17 +40,19 @@ refresh token, as well as `profile` which contains the authenticated user's
Facebook profile. The `verify` callback must call `cb` providing a user to
complete authentication.
- passport.use(new FacebookStrategy({
- clientID: FACEBOOK_APP_ID,
- clientSecret: FACEBOOK_APP_SECRET,
- callbackURL: "http://localhost:3000/auth/facebook/callback"
- },
- function(accessToken, refreshToken, profile, cb) {
- User.findOrCreate({ facebookId: profile.id }, function (err, user) {
- return cb(err, user);
- });
- }
- ));
+```js
+passport.use(new FacebookStrategy({
+ clientID: FACEBOOK_APP_ID,
+ clientSecret: FACEBOOK_APP_SECRET,
+ callbackURL: "http://localhost:3000/auth/facebook/callback"
+ },
+ function(accessToken, refreshToken, profile, cb) {
+ User.findOrCreate({ facebookId: profile.id }, function (err, user) {
+ return cb(err, user);
+ });
+ }
+));
+```
#### Authenticate Requests
@@ -60,15 +62,17 @@ authenticate requests.
For example, as route middleware in an [Express](http://expressjs.com/)
application:
- app.get('/auth/facebook',
- passport.authenticate('facebook'));
-
- app.get('/auth/facebook/callback',
- passport.authenticate('facebook', { failureRedirect: '/login' }),
- function(req, res) {
- // Successful authentication, redirect home.
- res.redirect('/');
- });
+```js
+app.get('/auth/facebook',
+ passport.authenticate('facebook'));
+
+app.get('/auth/facebook/callback',
+ passport.authenticate('facebook', { failureRedirect: '/login' }),
+ function(req, res) {
+ // Successful authentication, redirect home.
+ res.redirect('/');
+ });
+```
## Examples

0 comments on commit 3c5155f

Please sign in to comment.