我成功检索了用户的基本个人资料,但我也想获取生日。我怎样才能使这个工作?检查我的代码:
<script src="https://apis.google.com/js/platform.js" async defer></script>
<meta name="google-signin-client_id" content="XXXXXXXXXXXXXX">
<script>
function onSignIn(googleUser) {
var profile = googleUser.getBasicProfile();
console.log('ID: ' + profile.getId());
console.log('Name: ' + profile.getName());
console.log('Image URL: ' + profile.getImageUrl());
console.log('Email: ' + profile.getEmail());
});
}
</script>
<div class="g-signin2" data-onsuccess="onSignIn"></div>
答案 0 :(得分:0)
BasicProfile不包含生日。你必须manually retrieve profile information using Google+ API。以下是执行此操作的代码:https://stackoverflow.com/a/29903252/1256609