oauth 认证后的下一步 - 帆 [英] next step after the oauth authentication - sails

查看:38
本文介绍了oauth 认证后的下一步 - 帆的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的帆应用程序中遵循了this指南,每个人似乎都工作得很好.单击 localhost:1337/login 页面上的 twitter 按钮时,网站会将用户重定向到身份验证页面.当用户接受条款时,网站将用户重定向回服务器主页.到此结束,我该如何使用 twiiter 显然给我的推特数据?

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?

推荐答案

一旦用户在第三方服务中通过身份验证,他将连同他的帐户信息一起重定向回您的网站.您可以在护照服务中访问个人资料详情:

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..
}

有关 profile 变量的更多详细信息:passportjs.org/guide/profile/

More details about profile variable: passportjs.org/guide/profile/

这篇关于oauth 认证后的下一步 - 帆的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆