Struct twitch_oauth2::UserToken[][src]

pub struct UserToken {
    pub access_token: AccessToken,
    pub login: String,
    pub user_id: String,
    pub refresh_token: Option<RefreshToken>,
    pub never_expiring: bool,
    // some fields omitted
}
Expand description

An User Token from the OAuth implicit code flow or OAuth authorization code flow

Used for requests that need an authenticated user. See also AppAccessToken

See UserToken::builder for authenticating the user using the OAuth authorization code flow.

Fields

access_token: AccessToken

The access token used to authenticate requests with

login: String

Username of user associated with this token

user_id: String

User ID of the user associated with this token

refresh_token: Option<RefreshToken>

The refresh token used to extend the life of this user token

never_expiring: bool

Token will never expire

This is only true for old client IDs, like https://twitchapps.com/tmi and others

Implementations

Assemble token without checks.

If expires_in is None, we’ll assume token.is_elapsed is always false

Assemble token and validate it. Retrieves login, client_id and scopes

If the token is already expired, this function will fail to produce a UserToken and return ValidationError::NotAuthorized

Create a UserTokenBuilder to get a token with the OAuth Authorization Code

Set the client secret

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

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

Get the username associated to this token

Get the user id associated to this token

Refresh this token, changing the token to a newer one

Get current lifetime of token.

Retrieve scopes attached to the token

Returns whether or not the token is expired. Read more

Validate this token. Should be checked on regularly, according to https://dev.twitch.tv/docs/authentication#validating-requests Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Performs the conversion.

Should always be Self

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

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