File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44
55require (
66 github.com/blang/semver v3.5.1+incompatible
7- github.com/brianstrauch/spotify v0.2 .0
7+ github.com/brianstrauch/spotify v0.3 .0
88 github.com/pkg/browser v0.0.0-20210606212950-a7b7a6107d32
99 github.com/rhysd/go-github-selfupdate v1.2.3
1010 github.com/spf13/cobra v1.1.3
Original file line number Diff line number Diff line change @@ -26,8 +26,8 @@ github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kB
2626github.com/bketelsen/crypt v0.0.3-0.20200106085610-5cbc8cc4026c /go.mod h1:MKsuJmJgSg28kpZDP6UIiPt0e0Oz0kqKNGyRaWEPv84 =
2727github.com/blang/semver v3.5.1+incompatible h1:cQNTCjp13qL8KC3Nbxr/y2Bqb63oX6wdnnjpJbkM4JQ =
2828github.com/blang/semver v3.5.1+incompatible /go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk =
29- github.com/brianstrauch/spotify v0.2 .0 h1:CoKjSY/JqFOfMw3aD4YyC0YN49HPrn4vax4nLk0TBwo =
30- github.com/brianstrauch/spotify v0.2 .0 /go.mod h1:sImRT74obai+LNgFVxr+qNVq2yt5KEfvNxz6ZDfYWaA =
29+ github.com/brianstrauch/spotify v0.3 .0 h1:09iAmmn3pncnCdHOghiBH2r619HkWt35j59yEBXwUt0 =
30+ github.com/brianstrauch/spotify v0.3 .0 /go.mod h1:sImRT74obai+LNgFVxr+qNVq2yt5KEfvNxz6ZDfYWaA =
3131github.com/cespare/xxhash v1.1.0 /go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc =
3232github.com/client9/misspell v0.3.4 /go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw =
3333github.com/coreos/bbolt v1.3.2 /go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk =
Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ func NewCommand() *cobra.Command {
2929 Use : "login" ,
3030 Short : "Log in to Spotify." ,
3131 RunE : func (cmd * cobra.Command , _ []string ) error {
32- token , err := authorize ()
32+ token , err := login ()
3333 if err != nil {
3434 return err
3535 }
@@ -38,13 +38,23 @@ func NewCommand() *cobra.Command {
3838 return err
3939 }
4040
41- cmd .Println ("Success!" )
41+ api , err := internal .Authenticate ()
42+ if err != nil {
43+ return err
44+ }
45+
46+ user , err := api .GetUserProfile ()
47+ if err != nil {
48+ return err
49+ }
50+
51+ cmd .Printf ("Logged in as %s.\n " , user .DisplayName )
4252 return nil
4353 },
4454 }
4555}
4656
47- func authorize () (* spotify.Token , error ) {
57+ func login () (* spotify.Token , error ) {
4858 // 1. Create the code verifier and challenge
4959 verifier , challenge , err := spotify .CreateVerifierAndChallenge ()
5060 if err != nil {
You can’t perform that action at this time.
0 commit comments