pub trait TokenRefresher:
    Clone
    + Debug
    + Send {
    type Error;

    // Required methods
    fn get_access_token<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<String, Self::Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn refresh_access_token<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<String, Self::Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn base_url(&self) -> &str;

    // Provided method
    fn should_trace(&self, url: &UrlPatternMatchInput) -> bool { ... }
}
Expand description

Get and refresh access tokens

Required Associated Types§

source

type Error

The type to be returned in the event of a error during getting or refreshing an access token

Required Methods§

source

fn get_access_token<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<String, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get the current access token

source

fn refresh_access_token<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<String, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get a fresh access token

source

fn base_url(&self) -> &str

Get the base URL for requests

Provided Methods§

source

fn should_trace(&self, url: &UrlPatternMatchInput) -> bool

Returns whether the given URL should be traced. Following [TracingConfiguration::is_enabled], this defaults to true.

Object Safety§

This trait is not object safe.

Implementors§