4

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 -

  1. Open https://web-otp.glitch.me/ at your mobile browser.
  2. As webpage says, get @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.
Vaibhav Arora
  • 94
  • 1
  • 9
  • The code provided in the links are correct, but you need some network carrier to send you SMS of OTP. Also, try using in a mobile browser(or change to a mobile device using the toggle in chrome). And read this answer https://stackoverflow.com/a/59150919/11926970 – Not A Bot Nov 03 '20 at 06:04
  • I checked the feature. I tried on mobike only, I sent myself code from contacts and unknown number. I am experienced developer, and I debugged the code too. I am stating the event of navigator.credentials.get() for OTP is not getting trigged when an OTP is recieved. Can you check at your end and confirm me if issue exists at your end too? Because then I will report it to Chrome team – Vaibhav Arora Nov 04 '20 at 02:50
  • Can you update the question with the code you wrote and all the steps to reproduce the result? – Not A Bot Nov 04 '20 at 03:53
  • Done https://stackoverflow.com/users/11926970/not-a-bot – Vaibhav Arora Nov 04 '20 at 10:42
  • anybody else wants to try? – Vaibhav Arora Nov 10 '20 at 14:46
  • @VaibhavArora It does not work for me as well. I get a popup to Allow to read the message but the navigator.credentials.get() never gets resolved, until it times out. Were you able to find out something? – sainiankit Mar 31 '21 at 16:39
  • nope, I couldn't found anything else And didn't worked on it again – Vaibhav Arora Apr 30 '21 at 05:48
  • This is frustrating. I too am not able to get this to work, and I'm starting to wonder if this works for anybody. – Martyn Chamberlin Jan 05 '22 at 20:50
  • Did anyone ever get this to work at all? The demo is not working for me either! – Quinten C Feb 28 '22 at 17:29
  • Hi, I'm getting the autofill permisson popup for all the messages. does anyone know how can i get this permission only for my domain messages – sandeepnegi Oct 14 '22 at 03:49

3 Answers3

3

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>

Tanay Toshniwal
  • 142
  • 1
  • 11
0

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>
Quinten C
  • 660
  • 1
  • 8
  • 18
0

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.

Miguel
  • 3,349
  • 2
  • 32
  • 28