如何使用Web OTP API
Web OTP API(如下所述: https://web.dev/web.dev/web-otp/ )曾经工作。
但是现在,即使此页面上的演示链接也对我不起作用。
我获得了权限对话,但是承诺永远无法解决或投掷。
navigator.credentials.get({
otp: { transport:['sms'] },
signal: ac.signal
})
我已经挠头了一段时间。尝试使用不同格式为OTP SMS重新实现它。但仍然变得相同。我尝试了两款在Android 10上运行Chrome 100的单独的Android手机。
Web OTP API (as described here: https://web.dev/web-otp/) used to work.
But now even the demo link on this page is not working for me.
I get the permission dialog, but the Promise never gets resolved or throws.
navigator.credentials.get({
otp: { transport:['sms'] },
signal: ac.signal
})
I've been scratching my head for a while. Tried re-implementing it, using different formats for the OTP SMS. But still getting the same. I tried two separate Android phones both running Chrome 100 on Android 10.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

您是否使用相同的
@HostName
与您收到的SMS中的网站主机名?因为在不同的上@hostname
navigator.credentials.get()
函数完全不会返回承诺。Are you using the same
@Hostname
as your website Hostname in the SMS that you're receiving? because on different@Hostname
navigator.credentials.get()
function doesn't return promise at all.