'Unable to implement OTP with Web OTP API
Web OTP API information provided by https://web.dev/web-otp is good. But demo provided in https://web-otp.glitch.me/ is working as of now with Version 86.0.4240.111 (Official Build) (64-bit).
The main reason I could see is that navigation credentials event for OTP is not getting triggered, and I don't understand why this is happening.
Is it problem with codebase of https://web-otp.glitch.me/ OR chrome mentioned version has any problem?
Steps to reproduce -
- Open https://web-otp.glitch.me/ at your mobile browser.
- As webpage says, get
@web-otp.glitch.me #12345as text message to your mobile, from unknown number . And you should receive a dialog message, asking you whether you want your browser to input this OTP.
Solution 1:[1]
Try changing the host name, incorrect host name may stop the Promise from getting resolved, i.e., navigator.credentials.get
Make sure your last line of text message should be like this:
@<HOSTNAME_OF_WEBSITE> #<OTP>
Solution 2:[2]
After some experimenting it only seemed to work if the last line with text before the last line (with the @ and #) ended in numbers.
Really weird.
So its like:
OTP code: <OTP>
Ignore this: 1111
@<HOSTNAME_OF_WEBSITE> #<OTP>
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Tanay Toshniwal |
| Solution 2 | Quinten Cabo |
