iOS: Password Autofill and Suggestions

About Password Autofill

iOS 11+ introduces Password Autofill and Suggestions like Safari accessing them from keychain using apple-app-site-association.

You can now enable your apps to suggest the specific credentials at your login screen to reduce login delays and forgotten or mistyped passwords and usernames.


  • iOS 11+
  • Xcode 9
  • Paid Apple Developer Account
  • Write Access to your domain server e.g


Using Code:

usernameTextField.textContentType = .username passwordTextField.textContentType = .password

Using Storyboard:

Open your iOS project in Xcode and:


Set the Username TextField Content Type to Username as shown in the below. ios_username_content_type_in_xcode


Set the Password TextField Content Type to Password as shown. ios_password_content_type_in_xcode

Associated Domain


  1. Go to Project Navigator and Select your Project Root.
  2. From the Editing Area, Select Capabilities tab
  3. Scroll down to Associated Domains and
  4. Toggle the ON Switch
  5. Replace to your auth domain e.g - you can find your domain name in keychain access.
  6. Double-check the steps here to make sure all is configured correctly. Usually the step Add the Associated Domains feature to your App ID. is a possible issue here.

Possible Build Error Here (1): developer_signing_profile_error_in_xcode This means you’re Xcode Signing is not using a Paid Apple Developer Account. Solution: Just use your paid Developer Account for Xcode Code Signing.

Possible Error Here (2): error_project_associated_domain_in_xcode This Error Means that Associated Domains Feature is Disabled for this app id in the your Developer Portal Suolution: Follow the steps below to fix it.

Adding Associated Domains Feature to App ID.

  1. Login to your Apple Developer Portal
  2. From the left panel, Select Certificates, IDs & Profiles


  1. Select App IDs from the Left Panel again.

  2. Select your app id or name from the list of registered apps. Xcode automatically registers your apps as soon as you configure Signing.

    If your app id is not in the list, 1 Check Xcode Signing configuration for your project. 2 If Signing is correct, then Register your App following these steps Register App ID on Apple Developer Portal


Prefix (2): is the Team ID. Take note for we’ll need it later. ID (3): is the app id also same as Bundle Identifier set in Xcode. Also note this one.

  1. Read throgh the List of Services currently enabled for your app id If Associated Domains (4) is Disabled, click Edit (5) and Check next to Associated Domains to Enable it.


Simple Server Side Configuration

Using text-editor of your preference,

  1. Create a file named apple-app-site-association with the following JSON content:
    "webcredentials": {
        "apps": [ "apple_team_id.app_bundle_id" ]

Replace: apple_team_id with your Apple Developer Team ID. app_bundle_id with your App’s Bundle ID You can find your Team ID and App’s Bundle ID from the section above on Adding Associated Domains Feature to App ID.

  1. Copy file apple-app-site-association to your web server root or to .well-known directory in your web server root.

  2. Edit your web server config to return the JSON content.

For NGINX, use the settings below:

    # if file is in webroot
    location /apple-app-site-association {
        default_type application/json;
    # if file is in .well-known directory
    location /.well-known/apple-app-site-association {	
       default_type application/json;

Restart your webserver. For NGINX on Ubuntu: service nginx restart

Verify that the JSON content is being served on your domain loading either yourdomain/apple-app-site-association or yourdomain/.well-known/apple-app-site-association depending on which directory you added the file apple-app-site-association.

Build and Run your application.


Good Luck and Let me know :-D