pub struct TokenManager { /* private fields */ }Expand description
Token manager that handles automatic refresh
Implementations§
Source§impl TokenManager
impl TokenManager
Sourcepub fn new(credentials: OAuthCredentials) -> Self
pub fn new(credentials: OAuthCredentials) -> Self
Create a new token manager
Sourcepub fn sandbox(credentials: OAuthCredentials) -> Self
pub fn sandbox(credentials: OAuthCredentials) -> Self
Create a token manager for sandbox environment
Sourcepub async fn get_token(&self) -> Result<AccessToken, SfError>
pub async fn get_token(&self) -> Result<AccessToken, SfError>
Get a valid access token, refreshing if necessary
This method ensures you always have a valid token by:
- Checking if current token exists and is valid
- If expired, automatically refreshing
- Thread-safe access via RwLock
Sourcepub async fn invalidate(&self)
pub async fn invalidate(&self)
Invalidate the current token (force refresh on next request)
Auto Trait Implementations§
impl Freeze for TokenManager
impl !RefUnwindSafe for TokenManager
impl Send for TokenManager
impl Sync for TokenManager
impl Unpin for TokenManager
impl !UnwindSafe for TokenManager
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more