Struct twitch_oauth2::tokens::AppAccessToken [−][src]
pub struct AppAccessToken { pub access_token: AccessToken, pub refresh_token: Option<RefreshToken>, // some fields omitted }
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
impl AppAccessToken
[src]
impl AppAccessToken
[src]pub fn from_existing_unchecked(
access_token: AccessToken,
refresh_token: impl Into<Option<RefreshToken>>,
client_id: impl Into<ClientId>,
client_secret: impl Into<ClientSecret>,
login: Option<String>,
scopes: Option<Vec<Scope>>,
expires_in: Option<Duration>
) -> AppAccessToken
[src]
access_token: AccessToken,
refresh_token: impl Into<Option<RefreshToken>>,
client_id: impl Into<ClientId>,
client_secret: impl Into<ClientSecret>,
login: Option<String>,
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<RE, C, F>(
http_client: C,
access_token: AccessToken,
refresh_token: impl Into<Option<RefreshToken>>,
client_secret: ClientSecret
) -> Result<AppAccessToken, ValidationError<RE>> where
RE: Error + Send + Sync + 'static,
C: FnOnce(HttpRequest) -> F,
F: Future<Output = Result<HttpResponse, RE>>,
[src]
http_client: C,
access_token: AccessToken,
refresh_token: impl Into<Option<RefreshToken>>,
client_secret: ClientSecret
) -> Result<AppAccessToken, ValidationError<RE>> where
RE: Error + Send + Sync + 'static,
C: FnOnce(HttpRequest) -> F,
F: Future<Output = Result<HttpResponse, RE>>,
pub async fn get_app_access_token<RE, C, F>(
http_client: C,
client_id: ClientId,
client_secret: ClientSecret,
scopes: Vec<Scope>
) -> Result<AppAccessToken, TokenError<RE>> where
RE: Error + Send + Sync + 'static,
C: Fn(HttpRequest) -> F + Send,
F: Future<Output = Result<HttpResponse, RE>> + Send,
[src]
http_client: C,
client_id: ClientId,
client_secret: ClientSecret,
scopes: Vec<Scope>
) -> Result<AppAccessToken, TokenError<RE>> where
RE: Error + Send + Sync + 'static,
C: Fn(HttpRequest) -> F + Send,
F: Future<Output = Result<HttpResponse, RE>> + Send,
Generate app access token via OAuth client credentials flow
Trait Implementations
impl Clone for AppAccessToken
[src]
impl Clone for AppAccessToken
[src]fn clone(&self) -> AppAccessToken
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl TwitchToken for AppAccessToken
[src]
impl TwitchToken for AppAccessToken
[src]fn token_type() -> BearerTokenType
[src]
fn client_id(&self) -> &ClientId
[src]
fn token(&self) -> &AccessToken
[src]
fn login(&self) -> Option<&str>
[src]
fn user_id(&self) -> Option<&str>
[src]
fn refresh_token<'life0, 'async_trait, RE, C, F>(
&'life0 mut self,
http_client: C
) -> Pin<Box<dyn Future<Output = Result<(), RefreshTokenError<RE>>> + Send + 'async_trait>> where
RE: Error + Send + Sync + 'static,
C: FnOnce(HttpRequest) -> F + Send,
F: Future<Output = Result<HttpResponse, RE>> + Send,
RE: 'async_trait,
C: 'async_trait,
F: 'async_trait,
'life0: 'async_trait,
Self: 'async_trait,
[src]
&'life0 mut self,
http_client: C
) -> Pin<Box<dyn Future<Output = Result<(), RefreshTokenError<RE>>> + Send + 'async_trait>> where
RE: Error + Send + Sync + 'static,
C: FnOnce(HttpRequest) -> F + Send,
F: Future<Output = Result<HttpResponse, RE>> + Send,
RE: 'async_trait,
C: 'async_trait,
F: 'async_trait,
'life0: 'async_trait,
Self: 'async_trait,
fn expires_in(&self) -> Duration
[src]
fn scopes(&self) -> &[Scope]
[src]
fn is_elapsed(&self) -> bool
[src]
#[must_use]fn validate_token<'life0, 'async_trait, RE, C, F>(
&'life0 self,
http_client: C
) -> Pin<Box<dyn Future<Output = Result<ValidatedToken, ValidationError<RE>>> + Send + 'async_trait>> where
Self: Sized,
RE: Error + Send + Sync + 'static,
C: FnOnce(HttpRequest) -> F + Send,
F: Future<Output = Result<HttpResponse, RE>> + Send,
RE: 'async_trait,
C: 'async_trait,
F: 'async_trait,
'life0: 'async_trait,
Self: Sync + 'async_trait,
[src]
#[must_use]
fn validate_token<'life0, 'async_trait, RE, C, F>(&'life0 self,
http_client: C
) -> Pin<Box<dyn Future<Output = Result<ValidatedToken, ValidationError<RE>>> + Send + 'async_trait>> where
Self: Sized,
RE: Error + Send + Sync + 'static,
C: FnOnce(HttpRequest) -> F + Send,
F: Future<Output = Result<HttpResponse, RE>> + Send,
RE: 'async_trait,
C: 'async_trait,
F: 'async_trait,
'life0: 'async_trait,
Self: Sync + 'async_trait,
#[must_use]fn revoke_token<'async_trait, RE, C, F>(
self,
http_client: C
) -> Pin<Box<dyn Future<Output = Result<(), RevokeTokenError<RE>>> + Send + 'async_trait>> where
Self: Sized,
RE: Error + Send + Sync + 'static,
C: FnOnce(HttpRequest) -> F + Send,
F: Future<Output = Result<HttpResponse, RE>> + Send,
RE: 'async_trait,
C: 'async_trait,
F: 'async_trait,
Self: Send + 'async_trait,
[src]
#[must_use]
fn revoke_token<'async_trait, RE, C, F>(self,
http_client: C
) -> Pin<Box<dyn Future<Output = Result<(), RevokeTokenError<RE>>> + Send + 'async_trait>> where
Self: Sized,
RE: Error + Send + Sync + 'static,
C: FnOnce(HttpRequest) -> F + Send,
F: Future<Output = Result<HttpResponse, RE>> + Send,
RE: 'async_trait,
C: 'async_trait,
F: 'async_trait,
Self: Send + 'async_trait,
Auto Trait Implementations
impl RefUnwindSafe for AppAccessToken
impl RefUnwindSafe for AppAccessToken
impl Send for AppAccessToken
impl Send for AppAccessToken
impl Sync for AppAccessToken
impl Sync for AppAccessToken
impl Unpin for AppAccessToken
impl Unpin for AppAccessToken
impl UnwindSafe for AppAccessToken
impl UnwindSafe for AppAccessToken
Blanket Implementations
impl<T> Instrument for T
[src]
impl<T> Instrument for T
[src]pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T> Instrument for T
[src]
impl<T> Instrument for T
[src]pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T> Same<T> for T
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
pub fn vzip(self) -> V
impl<T> WithSubscriber for T
[src]
impl<T> WithSubscriber for T
[src]pub fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
[src]
S: Into<Dispatch>,