我的 Web 应用程序是用纯 JS 编写的,并带有一点 JQuery。没有其他底层平台。我正在使用 Google Auth 登录我的网络应用程序。这是相关代码:
let initGoogle = function() {
gapi.load('auth2', function(){
// Retrieve the singleton for the GoogleAuth library and set up the client.
auth2 = gapi.auth2.init({
client_id: 'my-client-id.apps.googleusercontent.com',
cookiepolicy: 'single_host_origin',
// Request scopes in addition to 'profile' and 'email'
//scope: 'additional_scope'
});
attachSignin(document.getElementById('login_google'));
});
$("#login_google").click(() => {
Utils.registerAnalytics("click", "login_google");
})
};
let attachSignin = function(element) {
console.log(element.id);
auth2.attachClickHandler(element, {},
async function(googleUser) {
// do some other stuff
}
);
}
这工作得很好,但在某些情况下 - 尝试使用 Google 登录(#login_google
在移动设备上单击按钮 - 会带来以下错误:
popup_blocked_by_browser
我正在阅读有关此错误的一些信息,并且我上面的代码相应地对齐了。仍然 - 这个问题在这里和那里发生。
我想念什么?
谢谢