google api - Beginner node.js app using passport + googleapis -


i'm working node.js try , make book library app using google books api , passport google strategy authentication. far can authenticate , access api. maybe silly question, how data use on collection view? have access google data after authentication , need redirect collection how build data new view?

app.get('/auth/google', passport.authenticate('google', {   scope: ['https://www.googleapis.com/auth/books', 'https://www.googleapis.com/auth/userinfo.profile'] }));  app.get('/auth/google/callback', passport.authenticate('google', {failureredirect: '/'}), function (req, res) {   // successful authentication, data , redirect user collection   googleapis.discover('books', 'v1').execute(function (err, client) {     oath2client.credentials = {       access_token: req.user.accesstoken,       refresh_token: req.user.refreshtoken     };     var req1 = client.books.mylibrary.bookshelves.list().withauthclient(oath2client);     req1.execute(function (err, bookshelves) {});   });   res.redirect('/collection'); });  app.get('/collection', routes.collection, function (req, res) {}); 

what could store data in session variable, , fetch route. here's example storing string , accessing page:

//enable session support app.use(express.cookieparser()); app.use(express.session({   secret: 'secret key signed cookies' }));  app.get('/foo', function(req, res) {   req.session.property = 'property value';   res.redirect('/bar'); });  app.get('/bar', function(req, res) {   //the session variables can accessed here   res.send(req.session.property); }); 

Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -