Skip to content

Commit

Permalink
Merge pull request #456 from jackmerrill/patch-1
Browse files Browse the repository at this point in the history
fix(lastfm): fix auth callback param
  • Loading branch information
techknowlogick committed May 9, 2022
2 parents d6506de + fbb64f2 commit 644eeb5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions providers/lastfm/lastfm.go
Expand Up @@ -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/"
)

Expand Down Expand Up @@ -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(),
Expand Down
4 changes: 2 additions & 2 deletions providers/lastfm/lastfm_test.go
Expand Up @@ -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) {
Expand Down

0 comments on commit 644eeb5

Please sign in to comment.