#57 Added email/password auth for android

master
Keith Irwin 2017-04-19 00:40:16 -04:00
parent 40808f8a05
commit 8069dcd1d1
No known key found for this signature in database
GPG Key ID: 378933C743E2BBC0
1 changed files with 9 additions and 6 deletions

View File

@ -21,6 +21,10 @@ module.exports = (app, passport) => {
},
loginCallback = (req,res)=>{
res.redirect( req.session.next || '/map' );
},
androidLoginCallback = (req,res)=>{
if (req.user){ res.send(req.user); }
else { res.sendStatus(401); }
};
// Login/-out
@ -261,11 +265,10 @@ module.exports = (app, passport) => {
}
}, loginCallback);
// Android auth
//TODO: See if there's a better method
app.get('/auth/google/idtoken', passport.authenticate('google-id-token'), (req,res)=>{
if (!req.user){ res.sendStatus(401); }
else { res.send(req.user); }
} );
// Android
app.get('/login/android/', passport.authenticate('local'), androidLoginCallback);
app.get('/login/android/google', passport.authenticate('google-id-token'), androidLoginCallback);
//TODO: Add android facebook login
//TODO: Add android twitter login
};