AutoFill username and password in iOS 12 - ios

I implemented AutoFill for stored username and password suggestion successfully in iOS 11.
I have two text fields in my login view controller, one for email, one for password. The content types are defined as follows:
email / username text field configuration
password text field configuration
This used to work just fine in iOS 11, but after upgrading my development iPad to iOS 12, the app suggests emails for the username field and the following happens when editing the password field:
In my create account view controller, I have 3 text fields: email, password, repeat password. Their content modes are setup as follows:
email → email address
password → new password, rule: minlength:8;
repeat password → new password, rule: minlength:8;
When editing the email address field, it properly suggests an email address. For the password and repeat password fields, however, it suggests stored passwords, instead of suggesting a new password.
What I tried
(illogically) flip the content mode setup, so the login password field is set to new password and the create account password fields are set to password
no success; in fact, no change of behavior at all
set content mode to none for login and create account fields so AutoFill can try to handle it automatically
no success; in fact, no change of behavior at all
Note
AutoFill is properly setup on the server. The stored passwords being suggested in the create account fields prove that
The functionality is still working on iOS 11 iPads
When logging in with a new username, the app will ask the user to add this username and password to Keychain, even on iOS 12
Any idea what I need to change so that stored username & password suggestion works in iOS 12 again?
Thanks!
Edit
As requested by #kralex below, here's my view hierarchy for the login view controller in the storyboard:
...and on the device:

Apple is doing some heuristic to make the best guess what you might need: autofill or a new password. However in some cases it might fail.
In your case the problem is related to the "Create Account Button". It makes the system think that it is a sign up form.
The easiest option to fix it: replace sign up UIButton with UILabel and add tapRecognizer to handle taps.

I had a similar issue and found out Apple's heuristics were tapping in to the class name of the view controller to determine whether to suggest a new password or use an existing one. It seems like even if I set the correct textContentType on my UITextFields, it still would use the name of the controller.
My UIViewController has both sign up and login on the same screen, but the controller is named RegistrationViewController. I changed it to LoginViewController to test, and found that the login portion started working, but the registration bit acted like it was login! Even with the correct textContentTypes set!
I wound up having to rename my UIViewController something that doesn't imply registration or login for it to actually respect my textContentTypes. It's awful. Truly awful.
I would imagine at least part of the reason this is/was happening to you is because the you have the word Welcome as the beginning of your view controller, unbelievable as it sounds.
By the way, I tried RegistrationLoginViewController (it chose the registration setup) and LoginRegistrationViewController (it chose the login setup), and neither worked. It has to avoid Apple's heuristics if you want to have both on the same controller.

Related

iOS (React Native) password autofill takes wrong field for username

In my react native application, I'm having trouble saving login and password to a keychain. It's functional, however, it's saving the incorrect username.
Email, First Name, Last Name, Password, and Confirm Password are the text boxes in my order for the signup page.
However, I gave the email field textContentType='username' and the password field textContentType='password'. However, it uses the last name as a username by default. It seems to ignore my textContentType.
I'm aware that similar problems have been raised in the community, but I'm looking for any updates or possible solutions rather than rearranging the fields?
Keychain takes Password and input right before password, in your case is Last Name. Try to reorder the form input positions.

How can I stop iOS from asking to save an incorrect password?

I'm rebuilding the login screen for our app, and getting some annoying behavior from iOS for failed logins. After the user enters a username and password, when I show a new view controller, the system pops up a sheet asking if I want to save the username and password.
This would just be okay if it only showed up for successful logins, but it also asks to save the password after the user fails to log in and taps the Cancel button to quit trying.
How does iOS determine when to show this sheet, and is there any way to tell it not to bother saving an incorrect password? Is this feature actually documented anywhere? I've seen the Password AutoFill page, but there's really not much there.
If you set the username and password field contents to nil before dismissing the view controller, then iOS will not prompt to save the account information.

Why does iOS Password Autofill not prompt to save password on keychain?

I am setting up iOS Autofill Password in my app, and I followed all the guidelines in this tutorial https://medium.com/developerinsider/ios12-password-autofill-automatic-strong-password-and-security-code-autofill-6e7db8da1810. If I have a manually saved password in the keychain for the app's website, it gives me the option to autofill it on login.
However, when the credentials are not saved, the app does not prompt me to save them on login.
My username and password textfields are with correct content types (just like in your tutorial), I have the apple-app-site-association file configured properly, and the associated domains as well.
I don't understand what I am missing.
You didn't put any log about that. But the AutoFill feature has some tricks that need attention as describe on Robots & Pencils and other question in stack overflow
One attention point if you update the apple-app-site-association remove the app from your device and install again because the app store the last version as a cache.
Verify the TEAM ID on apps in apple-app-site-association because many get confused with the signing id from your account.
Known issue:
[AutoFill] Cannot show Automatic Strong Passwords for app bundleID: app.bundle.id due to error: iCloud Keychain is disabled
Do you need check on your macOS on Internet Account -> iCloud -> Keychain is enabled and verify in your idevice if the feature is enabled on Settings -> Apple ID -> iCloud -> Keychain is On
In the other case if you followed the tutorial correctly it will be working
I had the same problem. In my case the issue was that I was clearing the username and password text fields after successful authentication before pushing my next view. Apple's heuristics seem to require the text fields with .username and .password content types to be populated when the view disappears.
I was having same problem. I did all the setup which recommended by Apple (https://developer.apple.com/documentation/security/password_autofill/about_the_password_autofill_workflow).I had few fields in between UserName and Password field on Signup Screen. But when I put Password field just next to UserName field then Apple popup to save password appearing.
I have the same problem, Because 3 textField in my viewController, usernameTextField,passwordTextField and authcodeTextField.Set passWordTextField.becomeFirstResponder() before release the controller, its work for me

Password Autofill iOS 12 not working properly

I followed this guide:
https://medium.com/developerinsider/ios12-password-autofill-automatic-strong-password-and-security-code-autofill-6e7db8da1810
I created a github page and put the json file in this structure: snguyenevolution1.github.io/.well-known/apple-app-site-association.
I have the file validated here: https://branch.io/resources/aasa-validator/
Here is the entitlement:
There is a saved entry for snguyenevolution1.github.io in keychain. But when I tap on the username/password text field, the quick type row above the keyboard only show Password, not password for snguyenevolution1.github.io.
After tapping on that password and verify my touch ID, it brings up the entire list of all saved password in keychain, and I can literally pick anything from that list. I want it to automatically select the entry like it does in the tutorial.
Could someone please point out what I'm doing wrong? I'm pretty positive that the ids are matched.
Thanks
You should set in entitlement Associated Domains like this applinks:your_domain
References
Support Universal Links in your iOS App
iOS12 - Password AutoFill, Automatic Strong Password, and Security Code AutoFill
Does it do this for all password managers? I use 1Password 7 and it works ok. Look in your accounts and passwords setting and make sure you have a password saved for that specific website.

Parse.com - Email Verification and adding a new object with Swift

I have got my Parse.com login view controller and sign up view controller working just fine but I would like to do email verification. So when the user has verified through email, they can enter the app but if not, they are denied access.
Also, I would like another text field where the user enters details for a special code, it's like the secondary password I guess, this will also have to be entered into the sign up screen when they sign up to the app.
Other than that, I can register users and get them to log in, I just need help with this.

Resources