From a70d76536177dcec0b64e416e3e53a992fcc8eae Mon Sep 17 00:00:00 2001 From: Adam French Date: Sun, 23 Nov 2025 21:34:20 +0000 Subject: [PATCH] listening to added --- backend/main.go | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/backend/main.go b/backend/main.go index ca0d755..fe886f2 100644 --- a/backend/main.go +++ b/backend/main.go @@ -9,8 +9,6 @@ import ( "adam-french.co.uk/backend/handlers" "adam-french.co.uk/backend/services" - - spotifyauth "github.com/zmb3/spotify/v2/auth" ) func main() { @@ -35,21 +33,11 @@ func main() { redirectURL := os.Getenv("SPOTIFY_REDIRECT_URI") clientID := os.Getenv("SPOTIFY_CLIENT_ID") clientSecret := os.Getenv("SPOTIFY_CLIENT_SECRET") + spotifyConfig := services.SpotifyConfig{AuthState: authState, RedirectURL: redirectURL, ClientID: clientID, ClientSecret: clientSecret} - auth := spotifyauth.New( - spotifyauth.WithRedirectURL(redirectURL), - spotifyauth.WithClientID(clientID), - spotifyauth.WithClientSecret(clientSecret), - spotifyauth.WithScopes( - spotifyauth.ScopeUserReadPlaybackState, - spotifyauth.ScopeUserReadCurrentlyPlaying, - ), - ) + auth := services.InitSpotifyAuth(spotifyConfig) - fmt.Println("Authenticate spotify with:") - fmt.Println(auth.AuthURL(authState)) - - store := handlers.Store{DB: db, SpotifyAuth: auth, SpotifyToken: nil} + store := handlers.Store{DB: db, SpotifyAuth: auth, SpotifyClient: nil} r.GET("/posts", store.GetPosts) r.POST("/posts", store.CreatePost)