Http Auth Credential Database
Supported Platforms: AndroidiOSmacOS
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"));
Did you find it useful? Consider making a donation to support this project and leave a star on GitHub . Your support is really appreciated!