Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions librespot/core/login.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions librespot/spotify.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}