twitch

package
v0.0.0-...-1c0eac8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 19, 2016 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ScopeUserRead provides read access to non-public user information, such
	// as their email address.
	ScopeUserRead string = "user_read"
	// ScopeUserBlocksEdit provides the ability to ignore or unignore on
	// behalf of a user.
	ScopeUserBlocksEdit string = "user_blocks_edit"
	// ScopeUserBlocksRead provides read access to a user's list of ignored
	// users.
	ScopeUserBlocksRead string = "user_blocks_read"
	// ScopeUserFollowsEdit provides access to manage a user's followed
	// channels.
	ScopeUserFollowsEdit string = "user_follows_edit"
	// ScopeChannelRead provides read access to non-public channel information,
	// including email address and stream key.
	ScopeChannelRead string = "channel_read"
	// ScopeChannelEditor provides write access to channel metadata (game,
	// status, etc).
	ScopeChannelEditor string = "channel_editor"
	// ScopeChannelCommercial provides access to trigger commercials on
	// channel.
	ScopeChannelCommercial string = "channel_commercial"
	// ScopeChannelStream provides the ability to reset a channel's stream key.
	ScopeChannelStream string = "channel_stream"
	// ScopeChannelSubscriptions provides read access to all subscribers to
	// your channel.
	ScopeChannelSubscriptions string = "channel_subscriptions"
	// ScopeUserSubscriptions provides read access to subscriptions of a user.
	ScopeUserSubscriptions string = "user_subscriptions"
	// ScopeChannelCheckSubscription provides read access to check if a user is
	// subscribed to your channel.
	ScopeChannelCheckSubscription string = "channel_check_subscription"
	// ScopeChatLogin provides the ability to log into chat and send messages.
	ScopeChatLogin string = "chat_login"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Provider

type Provider struct {
	IdentityURL string
	// contains filtered or unexported fields
}

Provider holds all the info for our Oauth2 provider. It's essentially a wrapper around the Oauth2 config to have an identity URL field.

func New

func New() *Provider

New returns a new provider. Some providers have their endpoints as part of the Oauth2 package. Twitch is not one of them, so it must be entered manually.

func (*Provider) BuildAuthURL

func (p *Provider) BuildAuthURL(state string) string

BuildAuthURL builds the authentication endpoint that we redirect our users to.

func (*Provider) GetCodeURL

func (p *Provider) GetCodeURL(r *http.Request) string

GetCodeURL gets the short-lived access code from the callback URL sp we can exchange it for an access token.

func (*Provider) GetIdentity

func (p *Provider) GetIdentity(tok *oauth2.Token) (*id.User, error)

GetIdentity gets the client's identity from the provider.

func (*Provider) GetToken

func (p *Provider) GetToken(code string) (*oauth2.Token, error)

GetToken gets the access and refresh tokens from the provider.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL