Reputation: 94
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 -
@web-otp.glitch.me #12345
as 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.Upvotes: 4
Views: 3637
Reputation: 3628
The hostname must match the one where the input form lives. If the input form is on a subdomain then that must be your hostname. The @hostname must start on a new line followed by exactly 1 space, and "#" and then your code.
Everything before or after is ignored. So you should on the start of the message use a more user friendly code, in case the OTP auto fill fails, the user can still understand and type manually.
there is a chance to use a iframe with the input verification, check the WEB OTP documentation for that special case.
Upvotes: 0
Reputation: 771
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>
Upvotes: 0
Reputation: 192
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>
Upvotes: 4