examples/offline/app.js
function ensureAuthenticated(req, res, next) {
  if (req.isAuthenticated()) {
    req.authClient = new googleapis.auth.OAuth2(GOOGLE_CLIENT_ID, GOOGLE_CLIENT_SECRET);
    req.authClient.credentials = req.session.googleCredentials;
    return next();
  }
  res.redirect('/');
}
function ensureAuthenticated(req, res, next) {
  if (req.isAuthenticated()) {
    req.authClient = new googleapis.auth.OAuth2(GOOGLE_CLIENT_ID, GOOGLE_CLIENT_SECRET);
    req.authClient.credentials = req.session.googleCredentials;
    return next();
  }
  res.redirect('/');
}
function ensureAuthenticated ( req , res , next ) { if ( req . isAuthenticated ( ) ) { req . authClient = new googleapis . auth . OAuth2 ( GOOGLE_CLIENT_ID , GOOGLE_CLIENT_SECRET ) ; req . authClient . credentials = req . session . googleCredentials ; return next ( ) ; } res . redirect ( '/' ) ; }
Simple route middleware to ensure user is authenticated, use on any protected resource. Also restores the user's Google oauth token from the session, available as req.authClient
Simple route middleware to ensure user is authenticated use on any protected resource . Also restores the user s Google oauth token from the session available as req . authClient