pub trait TokenSource: Send + Sync {
// Required method
async fn access_token(&self) -> Result<String>;
}Expand description
A source of atproto access tokens.
This trait abstracts over token acquisition for the direct PdsClient
(used by local runs and tests). A PdsClient can hold a dyn TokenSource
instead of a static Auth without any call-site change, so a token source
that refreshes out of band can be dropped in later.
It is async + Send + Sync so a background refresh can live behind it.
Required Methods§
Sourceasync fn access_token(&self) -> Result<String>
async fn access_token(&self) -> Result<String>
Return the current bearer access token to send as Authorization.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".