Prompt to display dialog for saving password to keychain from webview app
npm install @capgo/capacitor-autofill-save-passwordPrompt to display dialog for saving password to keychain from webview app
Fork of original plugin to work with Capacitor 7
IOS work for old versions and 18.3
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.
``bash`
npm install @capgo/capacitor-autofill-save-password
npx cap sync
Then add in your App.entitlements
`xml`
To associate your domain to your app.
ts
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));
}
`
$3
Add
apply plugin: 'com.google.gms.google-services' beneath apply plugin: 'com.android.application' in android/app/build.gradlethis 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 jsonthen add your domain in
example-app/android/app/src/main/res/values/strings.xmlwith
`xml
[{
\"include\": \"https://YOURDOMAIN/.well-known/assetlinks.json\"
}]
`API
promptDialog(...)
* readPassword()
* getPluginVersion()
* Interfaces
$3
`typescript
promptDialog(options: Options) => Promise
`Save a password to the keychain.
| Param | Type | Description |
| ------------- | ------------------------------------------- | ------------------------------- |
|
options | Options | - The options for the password. |--------------------
$3
`typescript
readPassword() => Promise
`Read a password from the keychain. Requires the developer to setup associated domain for the app for iOS.
Returns: Promise<ReadPasswordResult>
--------------------
$3
`typescript
getPluginVersion() => Promise<{ version: string; }>
`Get the native Capacitor plugin version.
Returns: Promise<{ version: string; }>
Since: 1.0.0
--------------------
$3
#### Options
| 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. |
#### ReadPasswordResult
| Prop | Type | Description |
| -------------- | ------------------- | ----------------------------- |
|
username | string | The username of the password. |
| password` | string | The password of the password. |