我正在尝试关注this
在以下情况下,我得到gSignIn
未定义错误,
头上也有<script src="https://apis.google.com/js/platform.js" async defer></script>
。
我缺少一些API?
如何达到gSignIn
方法?
我如何通过js触发singin?
navigator.credentials.get({
password: true,
federated: {
providers: [
'https://accounts.google.com'
]
},
mediation: 'required'
}).then(c => {
if (c) {
switch (c.type) {
case 'password':
return sendRequest(c);
break;
case 'federated':
return gSignIn(c);
break;
}
} else {
return Promise.resolve();
}
}).then(profile => {
if (profile) {
updateUI(profile);
}
}).catch(error => {
console.error('Sign-in Failed');
});