@@ -8,10 +8,10 @@ import (
88 "errors"
99 "fmt"
1010 "net/http"
11- "spotify/pkg"
12- "spotify/pkg/model"
1311 "time"
1412
13+ "github.com/brianstrauch/spotify"
14+ "github.com/brianstrauch/spotify/model"
1515 "github.com/pkg/browser"
1616 "github.com/spf13/cobra"
1717 "github.com/spf13/viper"
@@ -60,7 +60,7 @@ func authorize() (*model.Token, error) {
6060 // https://developer.spotify.com/documentation/general/guides/authorization-guide/#authorization-code-flow-with-proof-key-for-code-exchange-pkce
6161
6262 // 1. Create the code verifier and challenge
63- verifier , challenge , err := pkg .StartProof ()
63+ verifier , challenge , err := spotify .StartProof ()
6464 if err != nil {
6565 return nil , err
6666 }
@@ -70,7 +70,9 @@ func authorize() (*model.Token, error) {
7070 if err != nil {
7171 return nil , err
7272 }
73- uri := pkg .BuildAuthURI (RedirectURI , challenge , state )
73+
74+ scope := "user-library-modify user-modify-playback-state user-read-playback-state"
75+ uri := spotify .BuildAuthURI (RedirectURI , challenge , state , scope )
7476
7577 // 3. Your app redirects the user to the authorization URI
7678 if err := browser .OpenURL (uri ); err != nil {
@@ -83,7 +85,7 @@ func authorize() (*model.Token, error) {
8385 }
8486
8587 // 4. Your app exchanges the code for an access token
86- token , err := pkg .RequestToken (code , RedirectURI , verifier )
88+ token , err := spotify .RequestToken (code , RedirectURI , verifier )
8789 if err != nil {
8890 return nil , err
8991 }
0 commit comments