javascript - 如何使用 hello.js 获取用户电子邮件 ID?

标签 javascript html hello.js

我正在尝试使用 hello.js 登录网站。 我获得了用户名,但无法获得用户电子邮件 ID。我怎样才能得到这个?

我正在关注 this link .

这是我的代码:

<script src="hello.js" ></script>

<script>

hello.init({
    google: "742850147964-r4pfusmgmp2mtfbngh387e30k3692p79.apps.googleusercontent.com"  
}, {redirect_uri: 'index.php'});

hello.on('auth.login', function(auth) {

    // Call user information, for the given network
    hello(auth.network).api('/me').then(function(r) {       
        console.log("r.email = "+r.email);
        console.log("r.name== = "+r.name);
    });
});
</script>

最佳答案

我通过简单更改 hello.js 解决了我的问题。

对于谷歌:-

scope: {                
        basic: 'https://www.googleapis.com/auth/plus.me profile',
       }

scope: {                
        basic: 'https://www.googleapis.com/auth/userinfo.email',
       }

Facebook :-

scope: {                
        basic: 'public_profile',
       }

scope: {                
        basic: 'public_profile,email',
       }

关于javascript - 如何使用 hello.js 获取用户电子邮件 ID?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34348614/

相关文章:

javascript - JSF 命令按钮启用/禁用基于使用 javascript 的 JSF 复选框

javascript - 从 HTML 表单创建 PDF?后端还是前端应该负责?

javascript - (HTML + JS) 桌面客户端框架

javascript - 在 Hello.js 中验证访问 token 时出错

javascript - hello.js,获取访问 token (或任何东西)

javascript - 如何在响应式导航栏上放置 Logo 图像

Javascript - 通过带有标签的公共(public)值对对象数组进行分组

javascript - 使用 Socket.IO 实时显示点击计数器的应用程序

jquery - 子 DIV [绝对] 在 Safari 中不随父 DIV 一起移动