Skip to main content

TokenProvider

Trait TokenProvider 

Source
pub trait TokenProvider: Send + Sync {
    // Required method
    fn token(&self) -> BoxFuture<'_, Result<String>>;
}
Expand description

Supplies a currently-valid Bearer credential (Ably Token string or Ably JWT), refreshed on demand. The returned string is the raw token — the client adds the Bearer prefix. Implementations MUST be cheap to call when cached.

An implementation MUST NOT call back into the same Client it authenticates in order to obtain its token: the client’s cache mutex is non-reentrant and is held across this call, so doing so would deadlock.

Required Methods§

Source

fn token(&self) -> BoxFuture<'_, Result<String>>

Fetch a currently-valid token.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§