authentication - Express - Authenticating URI endpoints using facebook & Google -


i've got uri endpoint authentication working both facebook & google in express app through separate middlewares. facebook uses passport facebook-token strategy, whereas google wrote own middleware using nodejs client lib google api. want authenticate user on uri endpoint using both these middleware.

/* //google controller file module.exports = function(req,res,next){  } */ googlectrl = require('google controller file'); //this works fine app.get('someurl',googlectrl,function(req,res){ //google user authenticated }  //this works fine app.get('someurl',passport.authenticate('facebook-token',{session=false}),function(req,res){ //google user authenticated } 

but how combine 2 same uri. otherwise need use seperate uri google & fb. pls advice. pls note i've tried implementing google strategy , has not worked.

you can use 1 array field user object named providers shown below:

{   "name": "asdasd",   "providers": [ 'google'] } 

and @ server side check user using provider , call method accordingly. example:

if user requests google service provider call

function handlegoogleauthentication(){    // logic  } 

and if user requests facebook service provider call

function handlefacebookauthentication(){      //logic } 

Comments

Popular posts from this blog

account - Script error login visual studio DefaultLogin_PCore.js -

xcode - CocoaPod Storyboard error: -