我正在尝试使用hello.js插件来连接Facebook和google。
我的代码如下
<div id="profile"></div>
<script>
hello.on('auth.login', function(auth){
// call user information, for the given network
hello( auth.network ).api( '/me' ).then( function(r){
// Inject it into the container
var label = document.getElementById( "profile_"+ auth.network );
if(!label){
label = document.createElement('div');
label.id = "profile_"+auth.network;
document.getElementById('profile').appendChild(label);
}
label.innerHTML = 'Your Network '+ auth.network +' has <img src="'+ r.thumbnail +'" /> Hey '+r.name+' your ID is '+r.id+' And EMail '+r.email;
});
});
hello.init({
facebook : 'xxxxxx',
google : '3xxxxxxsrgut3466k1nunigepmsd3.apps.googleusercontent.com',
twitter : 'xxxxxxx'
},{redirect_uri:'http://wstation.xxx.com/'});
</script>因此,我试图打印一些细节,如姓名,身份证和电子邮件。
结果,我可以看到facebook的电子邮件,但谷歌的电子邮件不会来。
有谁能告诉我我是否需要在谷歌的电话里改变一些东西。
此外,Twitter登录在这里不起作用。我搞不懂要为twitter提供什么凭据。
提前谢谢
发布于 2014-11-20 08:03:48
所以我找到了解决办法
它在这里
基本上,我们将不得不这样调用插件。使用重定向URL旁边的作用域
hello.init({
// {provider:key,..}
},{
redirect_uri:'http://wstation.xxx.com/',
scope:'email'
}); 谢谢
发布于 2016-10-26 02:27:02
在facebook上添加
hello( auth.network ).api( '/me' scope{
email: 'email',
force: true
}).then 似乎适用于电子邮件和基本配置文件,但是对于google电子邮件凭证,您必须编辑hello.min.all.js文件。
发现
scope{basic:"https://www.googleapis.com/auth/plus.me profile", email:'email', ....而代之以
scope{ basic:"https://www.googleapis.com/auth/plus.me profile,https://www.googleapis.com/auth/userinfo.email", email:'email' ...https://stackoverflow.com/questions/27015944
复制相似问题