pub trait TokenSource:
Send
+ Sync
+ Debug {
// Required method
fn token<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<String, Box<dyn Error + Send + Sync>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}
Expand description
A TokenSource abstracts how a token is obtained or generated.
This is where you would implement the logic to fetch a token from a local cache, or a remote server (for example requesting a new token from an OAuth2 server).