【发布时间】:2015-04-30 10:39:22
【问题描述】:
我正在尝试使用 github 对用户进行身份验证,然后将他们的 avatar_url 传递给客户端。简化结构如下所示。
server/
publications.js
client/
users/
login.js
main.js
在我的client/users/login.js 文件中,我尝试获取包含头像 url 的用户对象的权限
Accounts.ui.config({
requestPermissions: {
github: ['user']
}
});
然后在我的server/publications.js,我尝试发布the data related to the avatar url。
Meteor.publish('userData', function() {
if(this.userId) {
return Meteor.users.find(
{ _id: this.userId }, {
fields: {
'services.github.id': 1,
'services.github.user.avatar_url': 1
}
})
} else {
this.ready();
}
});
但是,当我获得用户对象时,我从未获得与 github 用户相关的数据。如何使用 OAuth 访问用户?
【问题讨论】:
标签: javascript oauth meteor