首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Hello.js谷歌凭据未显示

Hello.js谷歌凭据未显示
EN

Stack Overflow用户
提问于 2014-11-19 11:39:48
回答 2查看 1.1K关注 0票数 0

我正在尝试使用hello.js插件来连接Facebook和google。

我的代码如下

代码语言:javascript
复制
<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提供什么凭据。

提前谢谢

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2014-11-20 08:03:48

所以我找到了解决办法

它在这里

链接

基本上,我们将不得不这样调用插件。使用重定向URL旁边的作用域

代码语言:javascript
复制
hello.init({
        // {provider:key,..}                       
},{
        redirect_uri:'http://wstation.xxx.com/',
        scope:'email'
}); 

谢谢

票数 0
EN

Stack Overflow用户

发布于 2016-10-26 02:27:02

在facebook上添加

代码语言:javascript
复制
hello( auth.network ).api( '/me' scope{
   email: 'email',
     force: true
}).then 

似乎适用于电子邮件和基本配置文件,但是对于google电子邮件凭证,您必须编辑hello.min.all.js文件。

发现

代码语言:javascript
复制
scope{basic:"https://www.googleapis.com/auth/plus.me profile", email:'email', ....

而代之以

代码语言:javascript
复制
scope{ basic:"https://www.googleapis.com/auth/plus.me profile,https://www.googleapis.com/auth/userinfo.email", email:'email' ...
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/27015944

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档