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]

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]

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]

Assemble token and validate it. Retrieves client_id and scopes.

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]

Generate app access token via OAuth client credentials flow

Trait Implementations

impl Clone for AppAccessToken[src]

impl Debug for AppAccessToken[src]

impl TwitchToken for AppAccessToken[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 

impl<T> WithSubscriber for T[src]