passport.js - Viewing user email and provider used in Passport and Sails.js with EJS -


how see used login provider in page made ejs, passport , sails.js? idea being able see after logging in facebook or twitter.

after hours trying, i've found answer. i'm using code generated sails-generate-auth. creates file called authcontroller (in api/controllers folder).

in callback function, called other named passport.callback, has line this:

req.session.authenticated = true; 

after line, can put other line:

req.session.provider = req.params.provider; 

by putting line, can access in ejs login provider selected user this

<div>logged <%=req.user.email%> (<%=req.session.provider%>)</div> 

Comments

Popular posts from this blog

android - Gradle sync Error:Configuration with name 'default' not found -

java - Andrioid studio start fail: Fatal error initializing 'null' -

html - jQuery UI Sortable - Remove placeholder after item is dropped -