我正在尝试使用 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/