Implementing AutoFill Credential Provider Extensions
Implementing AutoFill Credential Provider Extensions
WWDC 2018
![](https://cdn-images-1.medium.com/max/800/1*rM4lIy1CSOgahPpxmd5ElA.png)
![](https://cdn-images-1.medium.com/max/800/1*TIEKpsQeiCbjdgu1EwF7jA.gif)
![](https://cdn-images-1.medium.com/max/800/1*DvJM4GK3un_CCrvxkB2Cgg.gif)
![](https://cdn-images-1.medium.com/max/800/1*rRVExjgmiMwUDSo7GJnbAQ.png)
Password AutoFill Integration
- Configure your project
- Implement a credential list
- Show credentials in the QuickType bar
- Allow users to configure your extension in Settings
Step1: Configure Your Project
![](https://cdn-images-1.medium.com/max/800/1*XANbVrUbZhUJTF7yGDus1A.png)
![](https://cdn-images-1.medium.com/max/800/1*DHCsRCglLhTvbfMQ3r4vKg.png)
![](https://cdn-images-1.medium.com/max/800/1*eO32s-px4wD5DHDiWvu9Fw.png)
Step2: Implement a credential list
![](https://cdn-images-1.medium.com/max/800/1*3rJJ8GFwNI6X-VTsyQzBgQ.png)
![](https://cdn-images-1.medium.com/max/800/1*wTgx7_-9l7wq_KJnZEMN6w.png)
![](https://cdn-images-1.medium.com/max/800/1*Z4FhLmObQpoqy4djCHNj8g.png)
![](https://cdn-images-1.medium.com/max/800/1*uOdW8FibTa68nDtIeG6G7w.png)
![](https://cdn-images-1.medium.com/max/800/1*ysVCixr8-a8oaEIbpKthNA.png)
Best Practice
- Add a cancel button
- Allow users to see all their credentials
- Authenticate the user if needed
Step3: Show credentials in the QuickType bar
![](https://cdn-images-1.medium.com/max/800/1*cj_2As8xfT2a1Kdvjpa3cA.gif)
What you need to do
- Provide credential identities to AutoFill
- Return passwords from extension
- Show custom authentication UI (optional)
Provide credential identities to AutoFill
![](https://cdn-images-1.medium.com/max/800/1*F_b6U-S3YVifa_5vLnfBWw.png)
Use the credential identity store
- Secure, never leaves device
- Writable only by your app and extension
- Read only by AutoFill
- Modifiable only when extension is enabled
- Update the store as needed
- New credentials are available
- Credentials are modified
- Credentials are no longer available
![](https://cdn-images-1.medium.com/max/800/1*bsvJxu5A9rf7ua0UfRpqWA.png)
- The store may be unexpectedly deleted
- Extension is disabled, re-enabled
- App provides stale credential identities
- User restores from backup ASCredentialIdentityStore
can help
![](https://cdn-images-1.medium.com/max/800/1*_5dAXWzq7Wg9SKY9D5yIhw.png)
![](https://cdn-images-1.medium.com/max/800/1*G3wEouXm2BgG6hJiR5xcig.png)
![](https://cdn-images-1.medium.com/max/800/1*yy18uFI7tWiiC0t_4_yXUw.png)
Provide passwords from your extension
- Respond to the initial request quickly
- Users don’t see your UI yet
- AutoFill will cancel the request after a timeout
- Except simulator and debug builds
Best practices
- Keep the credential identity store up-to-date
- Use
ASCredentialIdentityStore
incremental update APIs - Keep extension UI to a minimum
- Avoid expensive setup in every
viewDidLoad()
Step4: Allow Users to Configure Your Extension in Settings
- Your extension may require additional setup after being enabled
- Provide credential identities for QuickType
- Sign user into online service
- Get user authentication or confirmation for QuickType - AuthenticationServices provides API for this
![](https://cdn-images-1.medium.com/max/800/1*FH4hNX24M25QpDYBmhuZJg.png)
![](https://cdn-images-1.medium.com/max/800/1*Ufl6_2QbXS16MeA0U8O0hA.png)
Extension Development ⚠️
Best practices
- User separate view controllers
- Present or user view controller containment
![](https://cdn-images-1.medium.com/max/800/1*TlNj3w02chqtL8iwR2gPAg.png)
- Extensions should be lightweight
- Use App Groups, shared keychains
Debugging AutoFill Credential Provider extensions
Use “Debug” > Attach to Process” for other cases
Use Safari to test filling credentials
1. Select your extension’s scheme
![](https://cdn-images-1.medium.com/max/800/1*_vWguKVV2tSXbM9n8zMDwg.png)
2. Run with Safari as a target
![](https://cdn-images-1.medium.com/max/800/1*K8TFdYYjKyQNOsFAXtEl8Q.png)
3. Invoke your extension
![](https://cdn-images-1.medium.com/max/800/1*t7nssasirHJzAgh7EDmRAA.png)