Friday 2 June 2017

Why doesn't my cookie get saved?

I do a POST ajax request when user clicks sign in. In the handler:

app.post('/auth', function(req,res,next){                                                                   

var token = req.body.token                                                                                  
session({ secret: 'keyboard cat', cookie: { maxAge: 60000*60*24 }})                                                                                                                                                           
  admin.auth().verifyIdToken(token)                                                                         
     .then(function(decodedToken) {                                                                          
       res.send({userID: decodedToken.uid})                                                                  
     }).catch(function(error) {                                                                              
       console.log(error.message)                                                                            
     })                                                                                                      
})

I am using express-session. My question is why does this cookie not get saved to the user's computer? I tested it out and it's not working.



via konyv12

No comments:

Post a Comment