Google 使用 Hello.js 登录为用户名返回“未定义”
Google Sign in Returning 'Undefined" for Username with Hello.js
所以我正在使用 hello.js http://adodson.com/hello.js/ 为我的应用程序创建社交登录按钮。
效果很好,我有 FB、LinkedIn 和 Twitter,而且 运行。对于 Google 但是我有一个小问题。
它允许我使用我的 Google 凭据登录,但是,我没有在应有的位置显示我的用户名和个人资料图片,而是得到 'undefined' 和一张丢失的图片。
这是我的代码
hello.init({
facebook: 'xxxx',
linkedin: 'xxxx',
twitter: 'xxxx',
google: 'xxxx'
}, {
redirect_uri: 'redirect.html'
});
hello.on('auth.login', function(auth){
// Get Profile
hello.api(auth.network+':/me', function(p){
document.getElementById('social-details').innerHTML = "<img src='"+ p.thumbnail
+ "' width=50/><br/><p class='lead text-primary'>Connected to "+ auth.network + " as " + p.name + "</p>";
});
});
密钥和重定向都有效。
如有任何帮助,我们将不胜感激!
错过了一个非常基本的步骤 - 我没有为我的 Google 应用程序启用 Google Plus API。
我从 Google 开发者控制台启用它后,它运行良好。
希望这对遇到同样问题的人有所帮助!
感谢所有花时间看我问题的人。
所以我正在使用 hello.js http://adodson.com/hello.js/ 为我的应用程序创建社交登录按钮。
效果很好,我有 FB、LinkedIn 和 Twitter,而且 运行。对于 Google 但是我有一个小问题。
它允许我使用我的 Google 凭据登录,但是,我没有在应有的位置显示我的用户名和个人资料图片,而是得到 'undefined' 和一张丢失的图片。
这是我的代码
hello.init({
facebook: 'xxxx',
linkedin: 'xxxx',
twitter: 'xxxx',
google: 'xxxx'
}, {
redirect_uri: 'redirect.html'
});
hello.on('auth.login', function(auth){
// Get Profile
hello.api(auth.network+':/me', function(p){
document.getElementById('social-details').innerHTML = "<img src='"+ p.thumbnail
+ "' width=50/><br/><p class='lead text-primary'>Connected to "+ auth.network + " as " + p.name + "</p>";
});
});
密钥和重定向都有效。
如有任何帮助,我们将不胜感激!
错过了一个非常基本的步骤 - 我没有为我的 Google 应用程序启用 Google Plus API。
我从 Google 开发者控制台启用它后,它运行良好。
希望这对遇到同样问题的人有所帮助!
感谢所有花时间看我问题的人。