init auth func
This commit is contained in:
@@ -1,9 +1,31 @@
|
||||
package services
|
||||
|
||||
import (
|
||||
"github.com/zmb3/spotify/v2"
|
||||
"fmt"
|
||||
|
||||
spotifyauth "github.com/zmb3/spotify/v2/auth"
|
||||
)
|
||||
|
||||
func InitSpotify() *spotify.Client {
|
||||
return nil
|
||||
type SpotifyConfig struct {
|
||||
AuthState string
|
||||
RedirectURL string
|
||||
ClientID string
|
||||
ClientSecret string
|
||||
}
|
||||
|
||||
func InitSpotifyAuth(config SpotifyConfig) *spotifyauth.Authenticator {
|
||||
auth := spotifyauth.New(
|
||||
spotifyauth.WithRedirectURL(config.RedirectURL),
|
||||
spotifyauth.WithClientID(config.ClientID),
|
||||
spotifyauth.WithClientSecret(config.ClientSecret),
|
||||
spotifyauth.WithScopes(
|
||||
spotifyauth.ScopeUserReadPlaybackState,
|
||||
spotifyauth.ScopeUserReadCurrentlyPlaying,
|
||||
),
|
||||
)
|
||||
|
||||
fmt.Println("Authenticate spotify with:")
|
||||
fmt.Println(auth.AuthURL(config.AuthState))
|
||||
|
||||
return auth
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user