因此,我现在所拥有的托管在http://exonia.meteor.com/上——我已经让 Google 身份验证工作正常,并且我已经拥有了我想要添加的两个 YouTube 范围并且也可以正常工作。但是,当我尝试从用户集合中的 YouTube API 访问任何数据时,我唯一拥有的是用户的全名,来自他们的 YouTube 个人资料。
如何访问 YouTube 数据?
编辑:我现在已经部署到上面提到的域,我很抱歉 - 正在部署到自定义域并且忘记了那个域。
因此,我现在所拥有的托管在http://exonia.meteor.com/上——我已经让 Google 身份验证工作正常,并且我已经拥有了我想要添加的两个 YouTube 范围并且也可以正常工作。但是,当我尝试从用户集合中的 YouTube API 访问任何数据时,我唯一拥有的是用户的全名,来自他们的 YouTube 个人资料。
如何访问 YouTube 数据?
编辑:我现在已经部署到上面提到的域,我很抱歉 - 正在部署到自定义域并且忘记了那个域。
If everything is going as intended, you should have access to the Youtube information in the server. If that's the case, then you need to tell Meteor to also expose that information to the client by publishing it (only basic info is published by default).
For instance, if you want to add some extra fields to the user object from the data you've received from Youtube, do something like this:
Meteor.publish("extra_fields", function() {
return Meteor.users.find(
{_id: this.userId},
{fields: {fieldYouWantToPublish: 1}} // 1 indicates you want to include that field
);
});
Meteor will automatically merge the requested fields into the user object for you. Don't forget to subscribe to it!