lib/routes/google.js
function oauth(httpRequest, httpResponse){
        var code = httpRequest.query.code,
            redirectUrl = _.has(grasshopper.config.identities, 'google') ? grasshopper.config.identities.google.redirectUrl : 'defaultRoute';


        grasshopper.auth('Google', { code: code })
            .then(function(token) {

                httpRequest.session.token = new Buffer(token).toString('base64');
                httpRequest.session.save(function() {
                    httpResponse.redirect(redirectUrl+'/'+ httpRequest.session.token);
                });


            })
            .fail(function(err){
                httpResponse.redirect(redirectUrl+'/error='+ err.message);
            });
    }
function oauth(httpRequest, httpResponse){
        var code = httpRequest.query.code,
            redirectUrl = _.has(grasshopper.config.identities, 'google') ? grasshopper.config.identities.google.redirectUrl : 'defaultRoute';


        grasshopper.auth('Google', { code: code })
            .then(function(token) {

                httpRequest.session.token = new Buffer(token).toString('base64');
                httpRequest.session.save(function() {
                    httpResponse.redirect(redirectUrl+'/'+ httpRequest.session.token);
                });


            })
            .fail(function(err){
                httpResponse.redirect(redirectUrl+'/error='+ err.message);
            });
    }
function oauth ( httpRequest , httpResponse ) { var code = httpRequest . query . code , redirectUrl = _ . has ( grasshopper . config . identities , 'google' ) ? grasshopper . config . identities . google . redirectUrl : 'defaultRoute' ; grasshopper . auth ( 'Google' , { code : code } ) . then ( function ( token ) { httpRequest . session . token = new Buffer ( token ) . toString ( 'base64' ) ; httpRequest . session . save ( function ( ) { httpResponse . redirect ( redirectUrl + '/' + httpRequest . session . token ) ; } ) ; } ) . fail ( function ( err ) { httpResponse . redirect ( redirectUrl + '/error=' + err . message ) ; } ) ; }
Method will accept the oauth callback from google, run authentication, then redirect the user to the page that accepts the token.
Method will accept the oauth callback from google run authentication then redirect the user to the page that accepts the token .