如何使用Web OTP API

发布于 01-22 18:43 字数 431 浏览 3 评论 0原文

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

我最亲爱的2025-01-29 18:43:45

您是否使用相同的@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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文