List icon Contents

Passwords

This guide describes how to save, update, and manage passwords the user enters in a new form online.

Overview

Chromium has a built-in functionality that allows remembering the entered credentials when the user submits a new form containing username and password. The library will ask you if you’d like to save the credentials.

If you save them, the next time you load the form, the library will suggest autofill it.

Password autofil

Saving passwords

When the user submits a new form containing a username and password, the SavePasswordHandler will be called. In the handler, you can decide whether to save the credentials for this website by returning the “Save” or “Never” option. For example:

Browser.Passwords.SavePasswordHandler = 
    new Handler<SavePasswordParameters, SavePasswordResponse>(p =>
    {
        return SavePasswordResponse.Save;
    });
Browser.Passwords.SavePasswordHandler = 
    New Handler(Of SavePasswordParameters, SavePasswordResponse)(Function(p)
        Return SavePasswordResponse.Save
    End Function)

If you choose to save the password, it will be added to the password store. If you select the “Never” option, the library will not suggest saving the passwords for this web page anymore.

Updating passwords

When the user submits the previously submitted form with the same username and a new password, the UpdatePasswordHandler will be called. In this handler, you can decide whether to update the existing credentials or ignore the new value. For example:

Browser.Passwords.UpdatePasswordHandler = 
    new Handler<UpdatePasswordParameters, UpdatePasswordResponse>(p =>
    {
        return UpdatePasswordResponse.Update;
    });
Browser.Passwords.UpdatePasswordHandler = 
    New Handler(Of UpdatePasswordParameters, UpdatePasswordResponse)(Function(p)
        Return UpdatePasswordResponse.Update
    End Function)

Managing passwords

Each element in the password store is represented by a PasswordRecord instance. It contains the user’s login and the URL of a web page where the form was submitted. It doesn’t contain the password itself.

To read all saved and blocklisted records, use:

IReadOnlyList<PasswordRecord> allPasswords = 
    Engine.Profiles.Default.PasswordStore.All;
Dim allPasswords As IReadOnlyList(Of PasswordRecord) = 
    Engine.Profiles.Default.PasswordStore.All

To read only saved records, use:

IReadOnlyList<PasswordRecord> savedPasswords = 
    Engine.Profiles.Default.PasswordStore.AllSaved;
Dim savedPasswords As IReadOnlyList(Of PasswordRecord) = 
    Engine.Profiles.Default.PasswordStore.AllSaved

To read only the records with the websites for which the passwords will never be saved, use:

IReadOnlyList<PasswordRecord> neverSavedPasswords = 
    Engine.Profiles.Default.PasswordStore.AllNeverSaved;
Dim neverSavedPasswords As IReadOnlyList(Of PasswordRecord) = 
    Engine.Profiles.Default.PasswordStore.AllNeverSaved

To remove all records from the store use:

PasswordStore.Clear();
PasswordStore.Clear()

To remove the records associated with a specific URL use:

PasswordStore.RemoveByUrl(url);
PasswordStore.RemoveByUrl(url)
Go Top