Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting autofill in Cordova for iOS

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.

like image 319
HaimL Avatar asked Nov 27 '19 08:11

HaimL


2 Answers

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" />
like image 66
NoodleOfDeath Avatar answered Oct 16 '22 19:10

NoodleOfDeath


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

like image 1
Titi Kr Avatar answered Oct 16 '22 19:10

Titi Kr