Hello,
Someone knows if it's possible in a Web Application make the auto paste from the OTP Code suggested by the phone when the SMS is received?
I think the issue it's because it's a web application and not mobile application. Someone already tried to do this?
If I have only one field works automatic, but as I have 6 fields I cannot take the value that I receive in the SMS.
Thanks, Paulo Torres
Hi Paulo.
Attached is a quick and simple example that uses the browser webotp api to detect an incoming code. Please read the mdn documentation https://developer.mozilla.org/en-US/docs/Web/API/WebOTP_API for details and supported browsers. As far as i know safari does not support webotp.
The inbound sms needs a specific structure so that it can automatically detect the embedded code. See the doc, but the format is e.g
Your code 12345
@yourdomain.com #12345
It is a textline followed by a blank line followed by @ domain name followed by # and the number.
Best
Stefan
Hi Stefan,
First of all thanks for your help, I was not aware about this API.
In fact what you did recognize the code and the code is suggested but the action SetCode is not triggered.
I made some changes in the JS and I add to the field the parameter 'autocomplete', I receive a popup asking if I allow the browser get the code from SMS and paste it but the problem it's the API doesn't return the OTP Code. Do you have an idea why?
Thanks a lot
mh. Don't know actually. It works in my phone as I provided my OML. Did you send the correct sms text as mentioned above?
Text + Blank Line + @com.domain #Code
?
Here as image.
It works on your phone? But the code is presented automatic without you click on suggested code?
Because this also works in mine. I was expected the API returns the code to split the code and put each digit in each input text.
Thanks again :)
Hi @Stefan Weber ,
You gave me the correct hint, the problem was my second line of the SMS that wasn't in the correct format. You also gave me the solution for my question, THANKS a lot :)
Regards, Paulo Torres