仅将Google智能锁添加到网站

snh*_*_nl 9 google-smartlockpasswords

Google Smart Lock在网站上

我刚刚访问了Pinterest,它有一个很酷的功能.不知何故,当我访问该网站时,Chrome可以"看到"我有一个帐户.而不是被动地等待它主动告诉我:你在这里有一个帐户:你想点击一次登录吗?是/否

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

问题:我看到很多应用程序的json代码示例.但是,我们如何主动将此添加到用户已存储uname/passwd的网站?

示例图片

谢谢,肖恩

Ste*_*eff 12

这篇文章描述了如何在您的网站上添加Smart Lock登录:https://developers.google.com/web/updates/2016/04/credential-management-api

基本上,像这样在(https)网站上添加一些代码(您可以在JavaScript控制台中尝试:

navigator.credentials.get({  
  password: true, // `true` to obtain password credentials  
}).then(function(cred) {  
  // continuation which submits the credential and signs the user in 
  ... 
Run Code Online (Sandbox Code Playgroud)

这是一个完整的示例网站:https://credential-management-sample.appspot.com/

一旦用户使用了该凭证或您已将其保存navigator.credentials.store(),将来可以自动检索(无需用户点击).

有关此问题的更多信息,请查看Google I/O中的此演讲(有关凭据管理API的详细信息,大约需要8分钟).