How to detect when user used Password AutoFill on a UITextField?

I've implemented all the app and server changes necessary to support Password Autofill on iOS 11, and it works well. I'd like it to work a little better.


My username and password fields are UITextFields. I would like to identify when a user has "autofilled" one of the two UITextFields, so I can progress to the next step. Currently the user autofills an item, then needs to press the "Next" button on the on-screen keyboard in order to advance. I'd like to trigger this on behalf of the user.


The WWDC2017 Password Autofill session says to use UITextFieldTextDidChange. This works, but of course this is also triggered when a user is manually typing in those fields.


My thought has been to compare the prior version of the text with the new version of the text, and assume that if the length has increased from zero to greater than some minimal length (2 or more), the user used autofill. That should work most of the time, but has a risk of a false trigger (fast typing on slow device perhaps). So to me, this may be a risky assumption.


I'm curious is anyone has found a more surefire way to determine if Password Autofill has been used on a UITextField, or just thinks my worry about a false trigger is unfounded.

Replies

>> I'd like to trigger this on behalf of the user.


But why? What makes you think this is "a little better"? It commits the user to an action, when the user may not have been ready to go ahead and log in. It may in fact be unnerving, because a user could construe this as the device taking control away from the user, in a security-sensitive area.


>> The WWDC2017 Password Autofill session says to use UITextFieldTextDidChange.


It says to use the notification to "validate the UI", meaning things like enabling or disabling "Login" or "Next" buttons. It's 100% clear that the intended use case involves 2 taps, one to fill the fields, and one to go to the next login step.


>> this may be a risky assumption


Um, yes. Pasting (of a partial password) seems like the obvious flaw.


My suggestion is that you don't attempt to do anything along this line right now. If there's an actual usability problem, users will complain and you can consider a change then. If not, then you don't need to twist yourself in knots solving a non-problem.


Also, I recommend you file a bug report asking for an enhancement such as a specific didChange notification when a field is auto-filled. If you can make a convincing case, Apple may listen.

Great answer.


I agree with you, requiring the extra tap in a sensitive process such as authentication is a non-issue.

It's always good to think a process through and try to keep things natural & quick for the user, but I think it might be counter-productive in this case, for all the valid reasons stated above.

Interesting feedback - much appreciated. Thinking as a user, I could go either way. We have 1Password integrated into the app. I've coded it such that the login process begins once I get the credentials from 1Password. Users haven't complained about that, although we don't have a huge number of 1Password users with this app. On the desktop, I believe auto submit is the 1Password default - although (admittedly) I have that feature turned off. So maybe you're onto something! :-) I think I'll leave it as-is for now, even if I do find an answer to the root question.


I did think of a second reason to find the answer though. I'd like to know if users actually use Password AutoFill. If I find an answer I'd like to add it to the app's analytics.

I have also encountered this issue, with a slightly different use case.


I am simply attempting to gain access to whether or not the user successfully authenticated to retrieve their passwords using the AutoFill method, but it seems there is no delegate or confirmation of such as of yet.


How does one go about requesting this functionality from Apple?

>How does one go about requesting this functionality from Apple?


Devs are free to submit enhancement requests via the bug reporter link below right.

I'm doing a little different approach here.


Upon showing the logn form, I check iCloud Keychian first with SecRequestSharedWebCredential. If the closure returns a credentials, which means user's intent is to login with it, then I automatically login for him/her. Otherwise, make the login text filed becomeFirstResponder().


This approach does not support third-party password manager, but most people use iCloud Keychain I believe.