【发布时间】:2014-10-09 03:08:31
【问题描述】:
我的 twitter 身份验证工作正常,但我需要的不仅仅是用户名和显示名,这只是 Passport 的限制。
我正在尝试这样做:
var newUser = new User();
newUser.uid = profile.id;
newUser.token = token;
newUser.username = profile.username;
newUser.displayName = profile.displayName;
newUser.profile_image_url = profile.profile_image_url;
如果正在查看护照文件,它会限制您可以使用的数据。我猜如果您使用多种身份验证方法,它是一致的,但我只需要使用 twitter。
passport.use(new TwitterStrategy({ ... },
function(token, tokenSecret, profile, done) {
console.log(profile);
....
}
);
如果我只是记录配置文件,那么它会提供所有数据,所以我很困惑如何绕过它。我需要来自 twitter 的完整数据,而不仅仅是护照为我挑选的一些数据,我怎样才能得到这个?
【问题讨论】:
-
根据this line in the source,应该有一个
profile._raw和一个profile._json属性与所有the data that twitter's API returns。可以查一下吗? -
谢谢,效果很好
标签: node.js twitter passport-twitter