javascript - Accessing the FB user id I got from passport JS -


i having issue trying use fb user id got passport js policy created. in application let user login fb, , created user in db if there isn't matching 1 already.

i have pretty basic node js app 1 place manage views (using hogan engine now). inside app.js file when do:

app.get('/myaccount', ensureauthenticated, function(req, res){       console.log('-- user id:' + req.user.id );       res.render('myaccount', { user: req.user }); }); 

i right userid. example mine xxxxxxx8342620263.

but in client side (my hjs file) im trying use same userid , similar different id.

<script type="text/javascript">      $(document).ready(function() {         // populate spends table         console.log('==populate spends account ' + {{user.id}});         populatemydata({{user.id}});     }); </script> 

for account xxxxxxx8342620264 instead of xxxxxxx8342620263. driving me insane. suggestions?

i tried

var userid = {{user.id}};     userid--;  

and reason still same wrong userid.


Comments