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
Post a Comment