From ce69e1da7673330af4118ddef963f492bd4192f4 Mon Sep 17 00:00:00 2001 From: Jack Merrill <8814123+jackmerrill@users.noreply.github.com> Date: Fri, 6 May 2022 10:56:18 -0500 Subject: [PATCH 1/2] fix(lastfm): fix auth callback param - Fixes callback url by changing "callback" to "cb" - Uses ".com" English website --- providers/lastfm/lastfm.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/providers/lastfm/lastfm.go b/providers/lastfm/lastfm.go index 6a88a81b6..a69ee879d 100644 --- a/providers/lastfm/lastfm.go +++ b/providers/lastfm/lastfm.go @@ -18,7 +18,7 @@ import ( ) var ( - authURL = "http://www.lastfm.com.br/api/auth" + authURL = "http://www.lastfm.com/api/auth" endpointProfile = "http://ws.audioscrobbler.com/2.0/" ) @@ -66,7 +66,7 @@ func (p *Provider) Debug(debug bool) {} func (p *Provider) BeginAuth(state string) (goth.Session, error) { urlParams := url.Values{} urlParams.Add("api_key", p.ClientKey) - urlParams.Add("callback", p.CallbackURL) + urlParams.Add("cb", p.CallbackURL) session := &Session{ AuthURL: authURL + "?" + urlParams.Encode(), From fbb64f264d63ceba64e6958fb61eac6b1952dd23 Mon Sep 17 00:00:00 2001 From: Jack Merrill <8814123+jackmerrill@users.noreply.github.com> Date: Fri, 6 May 2022 11:53:16 -0500 Subject: [PATCH 2/2] fix(lastfm): update tests --- providers/lastfm/lastfm_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/providers/lastfm/lastfm_test.go b/providers/lastfm/lastfm_test.go index 31154354d..5af851d6f 100644 --- a/providers/lastfm/lastfm_test.go +++ b/providers/lastfm/lastfm_test.go @@ -35,9 +35,9 @@ func Test_BeginAuth(t *testing.T) { session, err := provider.BeginAuth("") s := session.(*Session) a.NoError(err) - a.Contains(s.AuthURL, "www.lastfm.com.br/api/auth") + a.Contains(s.AuthURL, "www.lastfm.com/api/auth") a.Contains(s.AuthURL, fmt.Sprintf("api_key=%s", os.Getenv("LASTFM_KEY"))) - a.Contains(s.AuthURL, fmt.Sprintf("callback=%s", url.QueryEscape("/foo"))) + a.Contains(s.AuthURL, fmt.Sprintf("cb=%s", url.QueryEscape("/foo"))) } func Test_SessionFromJSON(t *testing.T) {