Skip to main content

TokenProvider

Type Alias TokenProvider 

Source
pub type TokenProvider = Arc<dyn Fn() -> Pin<Box<dyn Future<Output = Option<String>> + Send>> + Send + Sync>;
Expand description

Token provider callback type.

Called when the sync client needs a fresh JWT token — either proactively before expiry or reactively after an auth rejection. The provider should return a fresh JWT token string.

§Example

let provider: TokenProvider = Arc::new(|| Box::pin(async {
    my_auth_service.get_token().await
}));

Aliased Type§

pub struct TokenProvider { /* private fields */ }