Quantcast
Channel: Active questions tagged react-native+ios - Stack Overflow
Viewing all articles
Browse latest Browse all 16750

How to get iOS 12 Autofill to ask to save password in React Native app?

$
0
0

PROBLEM

I'm on React Native 0.59.9 (latest at the time of this post), and have a login screen in my mobile app that I would like iOS 12's autofill feature to pick up and save the password for a new user. With what I've set up, the app shows the keyboard with the autofill option but never pop's up the 'Save Password' for a new user's credentials.

What the keyboard autofill looks like right now:https://imgur.com/6gVpGbU

SOME BACKGROUND INFO

In React Native's documentation, they now expose textContentType in the TextInput component. To set it up for iOS 11 autofill, the username textContentType would be set to 'username' and the password textContentType would be set to 'password'.

RN textContentType documentation:https://facebook.github.io/react-native/docs/textinput#textcontenttype

For iOS 12 autofill, which is supposed to introduce the 'Save Password' feature to mobile app's as well now (previously was websites only) the configuration is different for the password.

The password textContentType would be set to 'newPassword' instead. This isn't working though, in fact it seems to be buggy and breaks the app as it suggests username's for the password field with this set...

Implementation

What I've tried to do to implement iOS 12's autofill feature in React Native:

<TextInput  placeholder={'Enter username'}  autoCapitalize={'none'}  autoCorrect={false}  textContentType={'username'}/><TextInput  placeholder={'Enter password'}  autoCapitalize={'none'}  autoCorrect={false}  secureTextEntry={true}  textContentType={'newPassword'}/>

In the mobile provision, I've made sure to enable Associated Domains as an entitlement. (Done through Apple Developer website).

In my domain (for example www.mydomain.com), the file apple-app-site-association (with no extension) that has the following has been put into the root directory and is publicly available (https supported).

{"webcredentials": {"apps": [“ZT978FY6AB.com.company.my.app”,        ]    }}

In XCode, I've set up the Associated Domains to point to that domain.Example:

webcredentials:www.mydomain.com

OUTPUT

The expected output of implementing this is that iOS pops up the 'Save Password' dialog when a new user enter's their credentials.

What the pop up dialog should look like:https://imgur.com/GH4hfP8

Instead, it never pops up. The user just heads straight into the app upon successful login without the dialog ever appearing for saving the password. This essentially means that none of my users can save their credentials to the password manager of their choice (not even iCloud keychain).

Since this feature does not seem to be testable on a simulator, I've been testing it on an iPhone 7 Plus with iOS 12.3.1 installed and autofill enabled in the settings as can be seen in the below image.

https://imgur.com/nSEmy7V

Any ideas what I'm doing wrong, or if I'm missing a step?


Viewing all articles
Browse latest Browse all 16750

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>