BasicAuthenticator class

Authenticator that uses HTTP Basic Authentication.

Encodes the username and password as a Base64 string and injects an Authorization: Basic <credentials> header into every request, as described in RFC 7617.

class MyConnector extends Connector {
  @override
  Authenticator? get authenticator =>
      BasicAuthenticator('user@example.com', 's3cr3t');
}
Implemented types

Constructors

BasicAuthenticator(String username, String password)
Creates a BasicAuthenticator with the supplied username and password.

Properties

hashCode int
The hash code for this object.
no setterinherited
password String
The password portion of the Basic Authentication credentials.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
username String
The username portion of the Basic Authentication credentials.
final

Methods

apply(Options options) → void
Adds Authorization: Basic <base64(username:password)> to the request options headers.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited