Documentation
¶
Overview ¶
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. SPDX-License-Identifier: Apache-2.0
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. SPDX-License-Identifier: Apache-2.0
Index ¶
- Constants
- type AuthorizationResponse
- type DeviceCodeFlowInitResponse
- type LoginParameters
- type LoginResponse
- func ClientCredentialsLogin(p LoginParameters) (LoginResponse, error)
- func CredentialsLogout(p LoginParameters) (LoginResponse, error)
- func RefreshUserToken(p RefreshParameters, shouldStoreInConfig bool) (LoginResponse, error)
- func UserCredentialsLogin_AuthorizationCodeFlow(p LoginParameters, webserverIP string, webserverPort string) (LoginResponse, error)
- func UserCredentialsLogin_DeviceCodeFlow(p LoginParameters) (LoginResponse, error)
- type RefreshParameters
- type UserAuthorizationQueryResponse
- type ValidateResponse
Constants ¶
const ClientCredentialsURL = "https://id.twitch.tv/oauth2/token?grant_type=client_credentials"
const DeviceCodeFlowGrantType = "urn:ietf:params:oauth:grant-type:device_code"
const DeviceCodeFlowTokenURL = "https://id.twitch.tv/oauth2/token"
const DeviceCodeFlowUrl = "https://id.twitch.tv/oauth2/device"
const RefreshTokenURL = "https://id.twitch.tv/oauth2/token?grant_type=refresh_token"
const RevokeTokenURL = "https://id.twitch.tv/oauth2/revoke"
const UserAuthorizeURL = "https://id.twitch.tv/oauth2/authorize?response_type=code"
const UserCredentialsURL = "https://id.twitch.tv/oauth2/token?grant_type=authorization_code"
const ValidateTokenURL = "https://id.twitch.tv/oauth2/validate"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuthorizationResponse ¶
type DeviceCodeFlowInitResponse ¶ added in v1.1.23
type LoginParameters ¶
type LoginResponse ¶
type LoginResponse struct {
Response AuthorizationResponse
ExpiresAt time.Time
}
func ClientCredentialsLogin ¶
func ClientCredentialsLogin(p LoginParameters) (LoginResponse, error)
Sends `https://id.twitch.tv/oauth2/token?grant_type=client_credentials`. Generates a new App Access Token. Stores new token information in the CLI's config.
func CredentialsLogout ¶
func CredentialsLogout(p LoginParameters) (LoginResponse, error)
Sends `https://id.twitch.tv/oauth2/revoke`. Revokes the provided token. Does not change the CLI's config at all.
func RefreshUserToken ¶
func RefreshUserToken(p RefreshParameters, shouldStoreInConfig bool) (LoginResponse, error)
Sends `POST https://id.twitch.tv/oauth2/token`. Refreshes the provided token and optionally stores the result in the CLI's config.
func UserCredentialsLogin_AuthorizationCodeFlow ¶ added in v1.1.23
func UserCredentialsLogin_AuthorizationCodeFlow(p LoginParameters, webserverIP string, webserverPort string) (LoginResponse, error)
Uses Authorization Code Flow: https://dev.twitch.tv/docs/authentication/getting-tokens-oauth/#authorization-code-grant-flow Sends `https://id.twitch.tv/oauth2/token?grant_type=authorization_code`. Generates a new User Access Token, requiring the use of a web browser. Stores new token information in the CLI's config.
func UserCredentialsLogin_DeviceCodeFlow ¶ added in v1.1.23
func UserCredentialsLogin_DeviceCodeFlow(p LoginParameters) (LoginResponse, error)
Uses Device Code Flow: https://dev.twitch.tv/docs/authentication/getting-tokens-oauth/#device-code-grant-flow Generates a new User Access Token, requiring the use of a web browser from any device. Stores new token information in the CLI's config.
type RefreshParameters ¶
type ValidateResponse ¶ added in v1.1.21
type ValidateResponse struct {
ClientID string `json:"client_id"`
UserLogin string `json:"login"`
UserID string `json:"user_id"`
Scopes []string `json:"scopes"`
ExpiresIn int64 `json:"expires_in"`
}
func ValidateCredentials ¶ added in v1.1.21
func ValidateCredentials(p LoginParameters) (ValidateResponse, error)
Sends `GET https://id.twitch.tv/oauth2/validate`. Only validates. Does not store this information in the CLI's config.