authenticate

package
v0.0.0-...-c6b27bc Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2023 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	SpotifyAuth = func(clid, cls string) *auth.Authenticator {
		return auth.New(
			auth.WithRedirectURL(redirectURI),
			auth.WithScopes(allscopes...),
			auth.WithClientID(clid),
			auth.WithClientSecret(cls))
	}
)

Functions

func Authenticate

func Authenticate() (client *spotify.Client, err error)

func RefreshToken

func RefreshToken(rtoken, clientId, clientSecret string) (token *oauth2.Token, err error)

Refresh Token if the previous one has expired. In practice I've only had this fire when scopes were changed. While Spotify docs meantion a timeout it is probably not enforced

Types

type RefreshError

type RefreshError struct {
	Error            string `json:"error"`
	ErrorDescription string `json:"error_description"`
}

type RefreshRequest

type RefreshRequest struct {
	GrantType    string `url:"grant_type,omitempty"`
	RefreshToken string `url:"refresh_token,omitempty"`
}

type RefreshResponse

type RefreshResponse struct {
	AccessToken string `json:"access_token"`
	TokenType   string `json:"token_type"`
	Scope       string `json:"scope"`
	ExpiresIn   int    `json:"expires_in"`
}

Jump to

Keyboard shortcuts

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