1

Google Smartlock を統合しています。JS コードを実行して 1 画面で Smart lock を有効にするたびに、まったく何もしません。手動でトリガーすると、これはコンソール ログにのみ表示されます。

Promise {[[PromiseStatus]]: "pending", [[PromiseValue]]: undefined}

ジャバスクリプトはこんな感じ

<script>
        window.onload=function(e){
            var debug = true;
            var always = function() { console.log('Promise resolved: but dont understand how should process: we want/need to login') }
            navigator.credentials.get({password: true, unmediated: true, }).then(function(cred) { 
            if (cred) {
                if (cred.type == 'password') {  
                var form = new FormData();
                cred.additionalData = form;
                var url = 'domain.com/login';
                fetch(url, {method: 'POST', credentials: cred }).then(function(response) { 
                    if (response.status == 202) {
                      if (debug) { console.log('Login success; reload stopped'); exit; }
                      window.location.reload();
                    }
                    if (debug) { console.log('Server status: ' + response.status); }
                    return;
                  }).catch(function(err) { console.log('Smartlock Ajax error:'+ err); 
                  }).then(always, always);
                } // can add federated here
            } else if (typeof cred === "undefined") {
                // user clicks cancel or no credentials found
                var expiry = new Date(); expiry.setDate(expiry.getDate() + (1/3600*30));
                document.cookie="dontshowagain=true; expires=" + expiry.toGMTString();
            }
            });

        }
        </script>

質問: ここで何が起こっているか知っている人はいますか?

保存したパスワードを 1 つ、保存したパスワードを 2 つ使用してテストしました。Chrome の URL の横に小さな鍵のアイコンが表示されます。しかし、ポップアップも何もしません。

ヘルプ/アドバイスをいただければ幸いです

ここに画像の説明を入力

ここに画像の説明を入力

参照: https://support.google.com/accounts/answer/6160273?hl=en

4

1 に答える 1