diff --git a/librespot/core/login.go b/librespot/core/login.go index dc82bce..4342de6 100644 --- a/librespot/core/login.go +++ b/librespot/core/login.go @@ -4,12 +4,13 @@ import ( "bytes" "encoding/base64" "fmt" + "log" + "github.com/golang/protobuf/proto" "github.com/librespot-org/librespot-golang/Spotify" "github.com/librespot-org/librespot-golang/librespot/connection" "github.com/librespot-org/librespot-golang/librespot/discovery" "github.com/librespot-org/librespot-golang/librespot/utils" - "log" ) var Version = "master" @@ -87,10 +88,10 @@ func LoginDiscoveryBlobFile(cacheBlobPath, deviceName string) (*Session, error) // Login to Spotify using the OAuth method func LoginOAuth(deviceName string, clientId string, clientSecret string) (*Session, error) { token := getOAuthToken(clientId, clientSecret) - return loginOAuthToken(token.AccessToken, deviceName) + return LoginOAuthToken(token.AccessToken, deviceName) } -func loginOAuthToken(accessToken string, deviceName string) (*Session, error) { +func LoginOAuthToken(accessToken string, deviceName string) (*Session, error) { s, err := setupSession() if err != nil { return s, err diff --git a/librespot/spotify.go b/librespot/spotify.go index c8a43b8..4178434 100644 --- a/librespot/spotify.go +++ b/librespot/spotify.go @@ -37,3 +37,8 @@ func LoginDiscoveryBlobFile(cacheBlobPath string, deviceName string) (*core.Sess func LoginOAuth(deviceName string, clientId string, clientSecret string) (*core.Session, error) { return core.LoginOAuth(deviceName, clientId, clientSecret) } + +// Login to Spotify using an existing accessToken +func LoginOAuthToken(accessToken string, deviceName string) (*core.Session, error) { + return core.LoginOAuthToken(accessToken, deviceName) +}