AuthProvider class abstract interface

Supplies the credentials a client attaches to each request.

Authentication is optional in v1: the default is AnonymousAuthProvider, and a registry with public reads works with no credentials at all. The port exists now so that adding auth later — a token, an OIDC flow, a signed request — is a constructor argument rather than a change to every call site.

headers is called before every request rather than once, which is what makes a refreshing token possible: an implementation can renew in the background and hand back the current value.

final client = OmnyStoreClient(
  baseUrl: 'https://store.example.com',
  auth: TokenAuthProvider('omny_pat_…'),
);
Implementers

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

close() FutureOr<void>
Releases any resources held.
headers() FutureOr<Map<String, String>>
Headers to merge into the next request. Return const {} for none.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
refresh() FutureOr<bool>
Called when the server answers 401, so a provider backed by a short-lived token can refresh and let the client retry once.
toString() String
A string representation of this object.
inherited

Operators

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