Reads a fixed access token from a text file for every authentication fetch.
The file must contain one non-empty line. Leading and trailing whitespace is removed. This bearer does not renew the token, but it sees file changes on later requests.
Returns a JSON-safe value for logs.
Creates a bearer for filePath. A leading ~ resolves to the home directory.
Optionalmetrics: AuthMetricsInputReadonly$typeContains the fully qualified runtime type name.
Returns the provider name for authorization metrics.
Returns the stable credential name used by file-backed token caches.
Most bearers do not have a name. Wrappers can add one with NamedBearer.
Returns the next bearer in a wrapper chain, when this bearer wraps another source.
Returns a JSON-safe value for logs.
Stops owned background work and closes the wrapped bearer.
OptionalgraceMs: numberReads and validates the current file contents.
Rejects when the file is empty, contains an embedded newline, or cannot be read. The returned token has no known expiration.
Creates a token receiver.
Reads a fixed access token from a text file for every authentication fetch.
The file must contain one non-empty line. Leading and trailing whitespace is removed. This bearer does not renew the token, but it sees file changes on later requests.
Example