McM*_*phy 5 javascript google-authentication async-await
如果我用 then(gAuth) 结构替换下面的 asynch/await,我对 Google Auth Init 的调用就可以工作。目前,init() 调用永远不会返回,并且浏览器挂起。
我是否误解了“等待”的要求?
async function gInit() {
// Check if already logged in with Google
try {
gAuth = await gapi.auth2.init({
client_id: providers.google.clientId
})
alert("sign in: " + gAuth.isSignedIn.get());
} catch (err) {
alert(err.message || err.text)
delete providers.google;
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1067 次 |
| 最近记录: |