Show the native save password prompt after login in your Capacitor app, so credentials land in the user's password manager, such as iCloud Keychain or Google Password Manager. Users sign in faster next time with autofill.
Capgo: push fixes to your Capacitor users in minutes, build signed iOS and Android apps without a Mac, and roll back in one click.
14-day unlimited free trial. No credit card required
🤖 Building with an AI coding agent? Install Capgo skills so Claude Code, Codex, Cursor, Copilot, or Gemini CLI know how to install and use
@capgo/capacitor-autofill-save-passwordin your Capacitor app:npx skills add Cap-go/capgo-skills. Then ask your agent: "Add @capgo/capacitor-autofill-save-password to my Capacitor app and wire it up." Agent setup guides · Hosted MCP
- Save prompt:
promptDialog()asks the OS to save the username and password. - Read back:
readPassword()lets the user pick a saved password for your app. - iOS: uses AuthenticationServices. On iOS 26.2 and later the credential goes to the user's chosen credential provider through
ASCredentialDataManager. - Android: uses the AndroidX Credential Manager.
- Platforms: iOS and Android. Not available on web.
Prompt to display dialog for saving password to keychain from webview app
Fork of original plugin to work with Capacitor 7+
The most complete doc is available here: https://capgo.app/docs/plugins/autofill-save-password/
| Plugin version | Capacitor compatibility | Maintained |
|---|---|---|
| v8.*.* | v8.*.* | ✅ |
| v7.*.* | v7.*.* | On demand |
| v6.*.* | v6.*.* | ❌ |
| v5.*.* | v5.*.* | ❌ |
Note: The major version of this plugin follows the major version of Capacitor. Use the version that matches your Capacitor installation (e.g., plugin v8 for Capacitor 8). Only the latest major version is actively maintained.
You can use our AI-Assisted Setup to install the plugin. Add the Capgo skills to your AI tool using the following command:
npx skills add https://github.com/cap-go/capacitor-skills --skill capacitor-pluginsThen use the following prompt:
Use the `capacitor-plugins` skill from `cap-go/capacitor-skills` to install the `@capgo/capacitor-autofill-save-password` plugin in my project.
If you prefer Manual Setup, install the plugin by running the following commands and follow the platform-specific instructions below:
npm install @capgo/capacitor-autofill-save-password
npx cap syncYou must set up your app’s associated domains. To learn how to set up your app’s associated domains, see Supporting Associated Domains in Apple Developer document.
Then add in your App.entitlements
<key>com.apple.developer.associated-domains</key>
<array>
<string>webcredentials:YOURDOMAIN</string>
</array>To associate your domain to your app.
import { Capacitor } from '@capacitor/core';
import { SavePassword } from '@capgo/capacitor-autofill-save-password';
login(username: string, password: string) {
// your login logic here
SavePassword.promptDialog({
username: username,
password: password,
})
.then(() => console.log('promptDialog success'))
.catch((err) => console.error('promptDialog failure', err));
}Add apply plugin: 'com.google.gms.google-services' beneath apply plugin: 'com.android.application' in android/app/build.gradle
this will allow the plugin to import the proper lib.
Then you need to make sure you did set properly your domain and did add google-services.json.
guide here https://developer.android.com/identity/sign-in/credential-manager
You need to have the file at this path android/google-services.json set, if you dont use firebase add empty json
then add your domain in example-app/android/app/src/main/res/values/strings.xml
with
<string name="asset_statements" translatable="false">
[{
\"include\": \"https://YOURDOMAIN/.well-known/assetlinks.json\"
}]
</string>On iOS 26.2 and later, promptDialog saves through ASCredentialDataManager, which routes the save to whichever credential provider the user has chosen, iCloud Keychain or a third-party manager. Below 26.2 it falls back to SecAddSharedWebCredential, which Apple deprecated in 26.2 and which only ever writes to iCloud Keychain.
Either way the url option names the domain the credential is saved against, and it must be one of the webcredentials: associated domains you set up above.
Note the two paths differ in what they report back. SecAddSharedWebCredential surfaces a dismissed prompt as an error, so promptDialog rejects. ASCredentialDataManager only throws when the system rejects the update, Apple describe it as equivalent to submitting a password form, so the user's choice never reaches the app. On 26.2 and later, treat a resolved promise as "the system accepted the request", not as confirmation that the password was saved.
On 26.2 and later you can also pass title to control the name the credential is filed under. Without it the password manager falls back to the bare domain, so users see app.example.com rather than your product name. The old API has no equivalent, so title is ignored below 26.2.
promptDialog(options: Options) => Promise<void>Save a password to the keychain.
On iOS 26.2 and later, resolving means the system accepted the request — not that the credential was stored. The save prompt belongs to the system and the user's choice is not reported back, so do not treat a resolved promise as confirmation. Below 26.2, and on Android, dismissing the prompt rejects.
| Param | Type | Description |
|---|---|---|
options |
Options |
- The options for the password. |
readPassword() => Promise<ReadPasswordResult>Read a password from the keychain. Requires the developer to setup associated domain for the app for iOS.
Returns: Promise<ReadPasswordResult>
getPluginVersion() => Promise<{ version: string; }>Get the native Capacitor plugin version.
Returns: Promise<{ version: string; }>
Since: 1.0.0
| Prop | Type | Description |
|---|---|---|
username |
string |
The username to save. |
password |
string |
The password to save. |
url |
string |
The url to save the password for. (For example: "console.capgo.app") iOS only. |
title |
string |
The name the credential is filed under in the password manager. (For example: "Capgo"). Defaults to the domain from url. iOS 26.2 and later only. |
| Prop | Type | Description |
|---|---|---|
username |
string |
The username of the password. |
password |
string |
The password of the password. |
