下面的代码工作正常,但从隐身 Windows 控制台打开时只显示
GoogleYolo loaded.
No credentials
<html>
<head><title>My Yolo Login example</title>
<script src="/common.js"></script>
<script defer src="https://smartlock.google.com/client"></script>
<script>
const PUBLIC_CLIENT_ID =
'*******-**********.apps.googleusercontent.com';
const CONFIG = {
supportedAuthMethods: [
'googleyolo://id-and-password',
'https://accounts.google.com'
],
supportedIdTokenProviders: [{
uri: 'https://accounts.google.com',
clientId: PUBLIC_CLIENT_ID
}],
context:"signUp"
};
window.onGoogleYoloLoad = (googleyolo) => {
console.log("GoogleYolo loaded.");
var retrievePromise = googleyolo.retrieve(CONFIG);
retrievePromise.then((credential) => {
console.log(credential);
},
(error)=>{
if(error.type == "noCredentialsAvailable"){
console.log("No credential");
googleyolo.hint(CONFIG).then((credentials)=>{console.log(credentials);});}
});
};
</script>
</head>
</html>
我怎么知道用户没有谷歌账户并重定向/采取其他行动让他登录到他的谷歌账户。