Is it possible to ask to user for permission to read sms of OTP on web app such as like android.
If it is possible then ask.
Is it possible to ask to user for permission to read sms of OTP on web app such as like android.
If it is possible then ask.
I was also looking for a way to read SMS from a browser and I end up finding out that support for the OTPCredential is finally getting traction. Here's a snippet from MDN:
navigator.credentials.get({
otp: { transport:['sms'] },
signal: ac.signal
}).then(otp => {
input.value = otp.code;
if (form) form.submit();
}).catch(err => {
console.log(err);
});
If you want to see the full code example MDN currently provides, you can access it here
Currently, according to Can I use there is some browser support for OTPCredential API, but it's a non-standard feature and should not be used without careful consideration
Hopefully it helps other people as well...
According to the documentation, progressive web apps and/or HTML5 API can't read or send SMS. Things have not moved a lot since this thread
Here is the W3C repo for Messaging API(which is used for sending SMS) and there is no progress for years and the API is still in proposal stage. So on hope for anytime soon.