nl_tokens: Function to initialize a session following authentication from a socialAuth provider
pl_tokens: function initSession ( req , res , next ) { var provider = getProvider ( req . path ) ; return user . createSession ( req . user . _id , provider , req ) . <mask> ( function ( mySession ) { return BPromise . resolve ( { error : null , session : mySession , link : null } ) ; } ) . then ( function ( results ) { var template ; if ( config . getItem ( 'testMode.oauthTest' ) ) { template = fs . readFileSync ( path . join ( __dirname , '../templates/oauth/auth-callback-test.ejs' ) , 'utf8' ) ; } else { template = fs . readFileSync ( path . join ( __dirname , '../templates/oauth/auth-callback.ejs' ) , 'utf8' ) ; } var html = ejs . render ( template , results ) ; res . status ( 200 ) . send ( html ) ; } , function ( err ) { return next ( err ) ; } ) ; }