如何使用 Meteor.loginWithGoogle 获取 Google+ 个人资料? [英] How to get Google+ profile with Meteor.loginWithGoogle?
问题描述
我正在寻找 Meteor.loginWithGoogle 的工作示例(使用meteor 0.6.4.1).
我为 loginWithGitHub 找到了这个 (https://www.eventedmind.com/posts/meteor-customizing-login) 在 GitHub 上运行良好.
它在没有参数的情况下工作正常,如客户端所示:
Template.user_loggedout.events({点击#login":函数(e,tmpl){Meteor.loginWithGoogle({}, 函数(错误){如果(错误){//错误处理alert('错误:'+err.message);} 别的 {}});}});
使用服务器端的帐户参数:
Accounts.loginServiceConfiguration.remove({服务:谷歌"});Accounts.loginServiceConfiguration.insert({服务:谷歌",客户 ID: 'XXXXXX',秘密:'YYYYYY'});
在这种情况下,我如何获取当前用户信息,尤其是邮件?有没有办法获取用户的 Google+ 个人资料(如果他有一个并允许这样做),例如用户的头像?requestPermissions: 需要什么参数,我能得到什么?
谢谢
经过一些研究,我构建了自己的示例,可在此处使用:https://github.com/lc3t35/googlelogin
感谢:
https://github.com/m2web/githublogin
https://github.com/ananta-IO/marq
https://developers.google.com/accounts/docs/OAuth2Login#obtaininguserprofileinformation
I'm looking for a working example of Meteor.loginWithGoogle (with meteor 0.6.4.1).
I found this one for loginWithGitHub (https://www.eventedmind.com/posts/meteor-customizing-login) that works fine with GitHub.
It works fine without parameters as show here on client side :
Template.user_loggedout.events({
"click #login": function(e, tmpl){
Meteor.loginWithGoogle({
}, function (err) {
if(err) {
//error handling
alert('error : '+err.message);
} else {
}
});
}
});
with the Accounts params on server side :
Accounts.loginServiceConfiguration.remove({
service: 'google'
});
Accounts.loginServiceConfiguration.insert({
service: 'google',
clientId: 'XXXXXX',
secret: 'YYYYYY'
});
In this case how can i get currentUser information especially the mail ? Is there a way to get the Google+ profile of the user (if he has one and allows this), the user's avatar for example ? What are the needed parameters for requestPermissions: , what can i get with this ?
Thanks
After some research i build my own example available here : https://github.com/lc3t35/googlelogin
Thanks to :
https://github.com/m2web/githublogin
https://github.com/ananta-IO/marq
Meteor/MongoDB see available fields for publish?
https://developers.google.com/accounts/docs/OAuth2Login#obtaininguserprofileinformation
这篇关于如何使用 Meteor.loginWithGoogle 获取 Google+ 个人资料?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!