Created
January 6, 2017 16:27
-
-
Save ivportilla/1c91293b7c8f52306c536f615096e778 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const auth = require('feathers-authentication'); | |
const FacebookTokenStrategy = require('passport-facebook-token'); | |
// const GooglePlusTokenStrategy = require('passport-google-plus-token'); | |
const local = require('feathers-authentication-local'); | |
const jwt = require('feathers-authentication-jwt'); | |
const oauth2 = require('feathers-authentication-oauth2'); | |
module.exports = function () { | |
const app = this; | |
const config = app.get('auth'); | |
app.configure(auth(config)) | |
.configure(local()) | |
.configure(jwt()) | |
.configure(oauth2({ | |
name: 'facebook', | |
Strategy: FacebookTokenStrategy, | |
})); | |
/* .configure(oauth2({ | |
name: 'google', | |
Strategy: GooglePlusTokenStrategy, | |
}));*/ | |
app.service('authentication').hooks({ | |
before: { | |
create: [ | |
auth.hooks.authenticate(['local', 'facebook', 'google']), | |
], | |
remove: [ | |
auth.hooks.authenticate('jwt'), | |
], | |
}, | |
}); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"host": "localhost", | |
"port": 3030, | |
"mongodb": "mongodb://localhost:27017/db", | |
"public": "../public/", | |
"auth": { | |
"secret": "Your secret", | |
"facebook": { | |
"clientID": "XXXXX", | |
"clientSecret": "ZZZZZ" | |
}, | |
"google": { | |
"clientID": "", | |
"clientSecret": "" | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
POST /authentication | |
body: { | |
"access_token": "kjbILH7hl8hpbyPBUP9...", | |
"strategy": "facebook" | |
} | |
RESPONSE: | |
{ | |
"access_token": "....." | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment