Skip to main content

TokenProvider

Trait TokenProvider 

Source
pub trait TokenProvider:
    Send
    + Sync
    + 'static {
    // Required method
    fn access_token(
        &self,
    ) -> Pin<Box<dyn Future<Output = Result<String, ClientError>> + Send + '_>>;
}
Expand description

A source of bearer access tokens.

Implementations are responsible for their own caching and refresh; BearerAuthInterceptor calls access_token before every request.

Required Methods§

Source

fn access_token( &self, ) -> Pin<Box<dyn Future<Output = Result<String, ClientError>> + Send + '_>>

Returns a currently-valid access token.

§Errors

Returns a ClientError when a token cannot be produced (e.g. the token endpoint rejected the credentials or is unreachable).

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§