listening to added
This commit is contained in:
@@ -9,8 +9,6 @@ import (
|
|||||||
|
|
||||||
"adam-french.co.uk/backend/handlers"
|
"adam-french.co.uk/backend/handlers"
|
||||||
"adam-french.co.uk/backend/services"
|
"adam-french.co.uk/backend/services"
|
||||||
|
|
||||||
spotifyauth "github.com/zmb3/spotify/v2/auth"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
@@ -35,21 +33,11 @@ func main() {
|
|||||||
redirectURL := os.Getenv("SPOTIFY_REDIRECT_URI")
|
redirectURL := os.Getenv("SPOTIFY_REDIRECT_URI")
|
||||||
clientID := os.Getenv("SPOTIFY_CLIENT_ID")
|
clientID := os.Getenv("SPOTIFY_CLIENT_ID")
|
||||||
clientSecret := os.Getenv("SPOTIFY_CLIENT_SECRET")
|
clientSecret := os.Getenv("SPOTIFY_CLIENT_SECRET")
|
||||||
|
spotifyConfig := services.SpotifyConfig{AuthState: authState, RedirectURL: redirectURL, ClientID: clientID, ClientSecret: clientSecret}
|
||||||
|
|
||||||
auth := spotifyauth.New(
|
auth := services.InitSpotifyAuth(spotifyConfig)
|
||||||
spotifyauth.WithRedirectURL(redirectURL),
|
|
||||||
spotifyauth.WithClientID(clientID),
|
|
||||||
spotifyauth.WithClientSecret(clientSecret),
|
|
||||||
spotifyauth.WithScopes(
|
|
||||||
spotifyauth.ScopeUserReadPlaybackState,
|
|
||||||
spotifyauth.ScopeUserReadCurrentlyPlaying,
|
|
||||||
),
|
|
||||||
)
|
|
||||||
|
|
||||||
fmt.Println("Authenticate spotify with:")
|
store := handlers.Store{DB: db, SpotifyAuth: auth, SpotifyClient: nil}
|
||||||
fmt.Println(auth.AuthURL(authState))
|
|
||||||
|
|
||||||
store := handlers.Store{DB: db, SpotifyAuth: auth, SpotifyToken: nil}
|
|
||||||
|
|
||||||
r.GET("/posts", store.GetPosts)
|
r.GET("/posts", store.GetPosts)
|
||||||
r.POST("/posts", store.CreatePost)
|
r.POST("/posts", store.CreatePost)
|
||||||
|
|||||||
Reference in New Issue
Block a user