1
0
mirror of https://github.com/yldio/copilot.git synced 2025-01-09 18:40:12 +02:00
copilot/legacy/spikes/auth/bell/src/routes/auth.js
Sérgio Ramos 8295bd6882 chore: initial lerna setup
this shall be a progressive process
2017-05-25 10:56:50 +01:00

36 lines
868 B
JavaScript

const path = require('path');
module.exports = (server) => {
server.route({
method: ['GET', 'POST'],
path: '/auth/twitter',
config: {
auth: 'twitter',
handler: (request, reply) => {
if (!request.auth.isAuthenticated) {
return reply('Authentication failed due to: ' + request.auth.error.message);
}
reply(`Welcome ${request.auth.credentials.profile.displayName}`);
}
}
});
server.route({
method: ['GET', 'POST'],
path: '/auth/github',
config: {
auth: 'github',
handler: (request, reply) => {
if (!request.auth.isAuthenticated) {
return reply('Authentication failed due to: ' + request.auth.error.message);
}
console.log(request.auth);
reply(`Welcome ${request.auth.credentials.profile.displayName}`);
}
}
});
};