I'm pretty new to Cordova dev. and I'm trying to achieve the following.
We have an application, running both on Android and iPhone, written in AngularJS, under the Cordova framework.
In order to use our application, we require the users to send their phone number, receive an SMS containing an OTP, type the OTP into a shaped text field, and press a button for sending the OTP (and receiving an authentication token).
I was asked to enable the simple feature of enabling the application to do that automatically, meaning it would parse the SMS, feed that input field, and send the OTP, without any user intervention.
This is pretty easily achieved on Android, using a specific SMS Receive plugin, but cannot be done in iOS.
However, I saw that it can be achieved semi-automatically on the new iOS versions, but I have to change the input field type to "one-time-code". I tried to do that on my Cordova code, and I couldn't achieve that, no matter what I did. I would like to know how to do it through Cordova, if this can be done, anyway.
You should be able to do this using purely HTML without needing a Cordova plugin or any native iOS code as described here. Just set the autocomplete
attribute, not the type
attribute, of the input element to one-time-code
:
<input id="single-factor-code-text-field" autocomplete="one-time-code" />
In my case it had to contain the word 'code' in the message then space and then the code you want to show. I'm not sure but I think it gets the symbols till the next space because I had more symbols after.
ex: code 123456
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With