Skip to main content
Version: 6.x.x

Http Auth Credential Database

To manage HTTP auth credentials, you can use the HttpAuthCredentialDatabase class, which implements a singleton object (shared instance).

On iOS and MacOS, this class uses the URLCredentialStorage class. On Android, this class has a custom implementation using android.database.sqlite.SQLiteDatabase because the WebViewDatabase class doesn't offer the same functionalities as iOS URLCredentialStorage.

Basic Usage

Here is an example of how to set a HTTP auth credential for a particular Protection Space:

// get the HttpAuthCredentialDatabase instance
HttpAuthCredentialDatabase httpAuthCredentialDatabase =
HttpAuthCredentialDatabase.instance();

// set a HTTP auth credential for a particular Protection Space
httpAuthCredentialDatabase.setHttpAuthCredential(
protectionSpace: URLProtectionSpace(
host: "example.com",
protocol: "http",
realm: "Realm",
port: 8081),
credential:
URLCredential(username: "USERNAME", password: "PASSWORD"));