Struct twitch_oauth2::tokens::AppAccessToken [−][src]
pub struct AppAccessToken { pub access_token: AccessToken, pub refresh_token: Option<RefreshToken>, // some fields omitted }
Expand description
An App Access Token from the OAuth client credentials flow
Used for server-to-server requests. Use UserToken
for requests that need to be in the context of an authenticated user.
In some contexts (i.e EventSub) an App Access Token can be used in the context of users that have authenticated the specific Client ID
Fields
access_token: AccessToken
The access token used to authenticate requests with
refresh_token: Option<RefreshToken>
The refresh token used to extend the life of this user token
Implementations
pub fn from_existing_unchecked(
access_token: AccessToken,
refresh_token: impl Into<Option<RefreshToken>>,
client_id: impl Into<ClientId>,
client_secret: impl Into<ClientSecret>,
scopes: Option<Vec<Scope>>,
expires_in: Option<Duration>
) -> AppAccessToken
pub fn from_existing_unchecked(
access_token: AccessToken,
refresh_token: impl Into<Option<RefreshToken>>,
client_id: impl Into<ClientId>,
client_secret: impl Into<ClientSecret>,
scopes: Option<Vec<Scope>>,
expires_in: Option<Duration>
) -> AppAccessToken
Assemble token without checks.
If expires_in
is None
, we’ll assume token.is_elapsed() == true
pub async fn from_existing<'a, RE, C>(
http_client: &'a C,
access_token: AccessToken,
refresh_token: impl Into<Option<RefreshToken>>,
client_secret: ClientSecret
) -> Result<AppAccessToken, ValidationError<<C as Client<'a>>::Error>> where
C: Client<'a>,
pub async fn from_existing<'a, RE, C>(
http_client: &'a C,
access_token: AccessToken,
refresh_token: impl Into<Option<RefreshToken>>,
client_secret: ClientSecret
) -> Result<AppAccessToken, ValidationError<<C as Client<'a>>::Error>> where
C: Client<'a>,
pub async fn get_app_access_token<'a, C>(
http_client: &'a C,
client_id: ClientId,
client_secret: ClientSecret,
scopes: Vec<Scope>
) -> Result<AppAccessToken, AppAccessTokenError<<C as Client<'a>>::Error>> where
C: Client<'a>,
pub async fn get_app_access_token<'a, C>(
http_client: &'a C,
client_id: ClientId,
client_secret: ClientSecret,
scopes: Vec<Scope>
) -> Result<AppAccessToken, AppAccessTokenError<<C as Client<'a>>::Error>> where
C: Client<'a>,
Generate app access token via OAuth client credentials flow
Trait Implementations
Get the type of token.
Client ID associated with the token. Twitch requires this in all helix API calls
Get the AccessToken for authenticating Read more
Refresh this token, changing the token to a newer one
Get current lifetime of token.
Returns whether or not the token is expired. Read more
fn validate_token<'a, 'life0, 'async_trait, C>(
&'life0 self,
http_client: &'a C
) -> Pin<Box<dyn Future<Output = Result<ValidatedToken, ValidationError<<C as Client<'a>>::Error>>> + Send + 'async_trait>> where
Self: Sized,
C: Client<'a>,
'a: 'async_trait,
C: 'async_trait,
'life0: 'async_trait,
Self: Sync + 'async_trait,
fn validate_token<'a, 'life0, 'async_trait, C>(
&'life0 self,
http_client: &'a C
) -> Pin<Box<dyn Future<Output = Result<ValidatedToken, ValidationError<<C as Client<'a>>::Error>>> + Send + 'async_trait>> where
Self: Sized,
C: Client<'a>,
'a: 'async_trait,
C: 'async_trait,
'life0: 'async_trait,
Self: Sync + 'async_trait,
Validate this token. Should be checked on regularly, according to https://dev.twitch.tv/docs/authentication#validating-requests Read more
Revoke the token. See https://dev.twitch.tv/docs/authentication#revoking-access-tokens
Auto Trait Implementations
impl RefUnwindSafe for AppAccessToken
impl Send for AppAccessToken
impl Sync for AppAccessToken
impl Unpin for AppAccessToken
impl UnwindSafe for AppAccessToken
Blanket Implementations
Mutably borrows from an owned value. Read more
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
type Output = T
type Output = T
Should always be Self
pub fn vzip(self) -> V
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more