zmb3 / spotify

A Go wrapper for the Spotify Web API
Apache License 2.0
1.33k stars 283 forks source link

func (a Authenticator) Token() more portable #225

Open drew-512 opened 1 year ago

drew-512 commented 1 year ago

Hi! I appreciate all the work that's gone into this pkg, and this PR helps make it more a little more reusable.

This PR makes func (a Authenticator) Token() now takes the redirected URL rather than a http.Request (which assumes Go was used as a server to receive the redirect and makes less sense to pass in).

It's either this or also add a http.Request variant of func (a Authenticator) Token() to other calls to have to be changed, but I think it makes more sense to take in the URL than the reader.

drew-512 commented 1 year ago

For example, in our project, we get the redirect URL pass to us as a string, so func (a Authenticator) Token() is not usable if it only accepts a http.Request to pull the URL from.