问题
I have followed this guide in my sails app and everyone seems to be working perfectly fine.
when clicking the twitter button on localhost:1337/login
page the website redirects the user to the authentication page. when the user accept the terms, the website redirect the user back to server homepage. here it ends, how can i use the twitter data that twiiter Apparently gave me?
回答1:
Once the user is authenticated in third-party service, he will be redirected back to your website together with his account information. You can access the profile details in your passport service:
/api/services/passport.js
passport.connect = function (req, query, profile, next) {
var user = {
firstName: profile.name.givenName,
lastName: profile.name.familyName
};
// save passport, user, etc..
}
More details about profile variable: passportjs.org/guide/profile/
来源:https://stackoverflow.com/questions/26754236/next-step-after-the-oauth-authentication-sails