pub async fn resolve_token(port: &impl AuthPort) -> Result<String, AuthError>Expand description
Resolve a live access-token string from an AuthPort.
- Calls
load_token(). - If the token is expired, calls
refresh_token(). - Returns the raw access token string, ready to be injected into a request.
§Errors
Returns Err if no token exists, storage is unavailable, or refresh fails.
§Example
let auth = Env;
let token = resolve_token(&auth).await?;
println!("Bearer {token}");