Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Login5 ¶
type Login5 struct {
// contains filtered or unexported fields
}
Login5 manages authentication against the Spotify Login5 endpoint (https://login5.spotify.com/v3/login). It handles challenge solving (hashcash), stores the resulting access token, and provides automatic token renewal via the AccessToken function.
Login5 is safe for concurrent use.
func NewLogin5 ¶
NewLogin5 creates a new Login5 client. The deviceId and clientToken are required for constructing LoginRequest messages. If client is nil a default HTTP client with a 30-second timeout is used.
func (*Login5) AccessToken ¶
func (c *Login5) AccessToken() spotcontrol.GetLogin5TokenFunc
AccessToken returns a GetLogin5TokenFunc that retrieves (and automatically renews) the Login5 access token. The returned function is safe for concurrent use.
When force is true, a fresh token is always obtained by re-authenticating with the stored credentials. When force is false, the cached token is returned if it has not yet expired.
func (*Login5) Login ¶
Login authenticates with the Login5 endpoint using the given credentials protobuf. Supported credential types are StoredCredential, FacebookAccessToken, OneTimeToken, ParentChildCredential, AppleSignInCredential, SamsungSignInCredential, and GoogleSignInCredential.
If the server responds with challenges (e.g. hashcash), they are solved automatically and the request is retried with the solutions.
func (*Login5) StoredCredential ¶
StoredCredential returns the stored credential bytes from the most recent successful Login5 authentication. These can be used to re-authenticate without the original password. It panics if Login has not been called successfully.
type LoginError ¶
type LoginError struct {
Code pb.LoginError
}
LoginError is returned when the Login5 endpoint returns an error code instead of a successful authentication response.
func (*LoginError) Error ¶
func (e *LoginError) Error() string