pub struct RefreshTokenAuth { /* private fields */ }Expand description
Refresh-token-grant auth session.
Construct via RefreshTokenAuth::builder.
Implementations§
Source§impl RefreshTokenAuth
impl RefreshTokenAuth
Sourcepub fn builder() -> RefreshTokenAuthBuilder
pub fn builder() -> RefreshTokenAuthBuilder
Begins constructing a RefreshTokenAuth.
Refresh-token grant (RFC 6749 §6): once an access token is obtained through any flow that issues a refresh token (typically Web Server with PKCE), use that refresh token to mint new access tokens at will. The refresh token itself is long-lived.
§Example
use cirrus::auth::RefreshTokenAuth;
use cirrus::Cirrus;
use std::sync::Arc;
let auth = RefreshTokenAuth::builder()
.consumer_key("3MVG9...")
.refresh_token("5Aep861...")
.login_url("https://login.salesforce.com")
.instance_url("https://my-org.my.salesforce.com")
.build()?;
let sf = Cirrus::builder().auth(Arc::new(auth)).build()?;Trait Implementations§
Source§impl AuthSession for RefreshTokenAuth
impl AuthSession for RefreshTokenAuth
Source§fn access_token<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = CirrusResult<Cow<'_, str>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn access_token<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = CirrusResult<Cow<'_, str>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Returns a valid bearer access token. Implementations may refresh
expired tokens transparently here; that is why the method is
async.Source§fn instance_url(&self) -> &str
fn instance_url(&self) -> &str
Returns the instance URL for REST requests, e.g.
https://my-org.my.salesforce.com. No trailing slash.Source§fn invalidate<'life0, 'life1, 'async_trait>(
&'life0 self,
stale_token: &'life1 str,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn invalidate<'life0, 'life1, 'async_trait>(
&'life0 self,
stale_token: &'life1 str,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Invalidates a cached token that the SDK has determined is no
longer valid (typically because Salesforce returned 401
INVALID_SESSION_ID when it was used). Read moreAuto Trait Implementations§
impl !Freeze for RefreshTokenAuth
impl !RefUnwindSafe for RefreshTokenAuth
impl Send for RefreshTokenAuth
impl Sync for RefreshTokenAuth
impl Unpin for RefreshTokenAuth
impl UnsafeUnpin for RefreshTokenAuth
impl !UnwindSafe for RefreshTokenAuth
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