Javascript 如何接收登录用户的生日?(谷歌签名,oAuth)
我创建了一个页面,用户可以用他的谷歌账号登录。 添加出生日期的范围,登录弹出窗口(图片)请求许可 我现在的问题是:我怎么知道出生日期? 我得到了姓名、个人资料照片和电子邮件,但没有出生日期Javascript 如何接收登录用户的生日?(谷歌签名,oAuth),javascript,google-signin,google-oauth,Javascript,Google Signin,Google Oauth,我创建了一个页面,用户可以用他的谷歌账号登录。 添加出生日期的范围,登录弹出窗口(图片)请求许可 我现在的问题是:我怎么知道出生日期? 我得到了姓名、个人资料照片和电子邮件,但没有出生日期 var startApp = function () { gapi.load('auth2', function () { // Retrieve the singleton for the GoogleAuth library and set up the client.
var startApp = function () {
gapi.load('auth2', function () {
// Retrieve the singleton for the GoogleAuth library and set up the client.
gapi.client.load('plus', 'v1', onGapiLoaded);
auth2 = gapi.auth2.init({
client_id: 'XXXXX.apps.googleusercontent.com',
cookiepolicy: 'single_host_origin',
// Request scopes in addition to 'profile' and 'email'
scope: 'https://www.googleapis.com/auth/user.birthday.read'
});
attachSignin(document.getElementById('customBtn'));
});
};
function attachSignin(element) {
console.log(element.id);
auth2.attachClickHandler(element, {},
function (googleUser) {
var GoogleUser = auth2.currentUser.get();
console.log(GoogleUser);
var id_token = googleUser.getAuthResponse().id_token;
verifyGoogleToken(id_token, function (payload) {
});
}, function (error) {
alert(JSON.stringify(error, undefined, 2));
});
}