Login 登录后检索Google用户信息(Meteor)

Login 登录后检索Google用户信息(Meteor),login,meteor,user-profile,google-login,accounts,Login,Meteor,User Profile,Google Login,Accounts,我无法显示我的谷歌用户名或个人资料图片。这就是我目前所拥有的 Accounts.onCreateUser(function(options, user){ if (options.profile) { options.profile.picture = "https://www.googleapis.com/plus/v1/people/" + user.services.google.id; user.profile = user.services.go

我无法显示我的谷歌用户名或个人资料图片。这就是我目前所拥有的

Accounts.onCreateUser(function(options, user){
    if (options.profile) {
        options.profile.picture = "https://www.googleapis.com/plus/v1/people/" + user.services.google.id;
        user.profile = user.services.google.picture;
    }
    return user;
});
我在我的个人资料模板中显示了这一点

            {{#if currentUser}}
                <img scr="{{currentUser.profile.picture}}" alt="{{currentUser.username}}">
            {{/if}}

我也有同样的问题,在通过谷歌认证(使用谷歌的软件包账户)后,我想获得更多关于用户的信息,尤其是个人资料图片

不幸的是,a:

Meteor.startup(function () {
   console.log(Meteor.user());
});
在客户端中,js将输出与您相同的结果,我只能访问

{{currentUser.profile.name}}
我用Robomongo连接到数据库并查找“users”表。令人惊讶的是,从谷歌获得的所有字段都在这里

我想,也许客户端默认情况下无法访问所有这些字段。因此,我在服务器js文件中添加了一个发布,以获取所有当前用户数据。然后让客户端js文件订阅发布

服务器JS:

Meteor.publish("userData", function () {
   return Meteor.users.find({_id: this.userId});
});
客户端JS:

Meteor.subscribe("userData");
然后我就能得到所有需要的田地

客户端HTML:

{{currentUser.services.google.id}}
{{currentUser.services.google.email}}
{{currentUser.services.google.picture}}

可以尝试
user.profile.picture=user.services.google.picture很遗憾,这不起作用。
{{currentUser.services.google.id}}
{{currentUser.services.google.email}}
{{currentUser.services.google.picture}}