Closed bttmly closed 3 years ago
Not sure if this helps, but there is a function Token() for the Client struct that returns the oauth2.Token defined here: https://github.com/zmb3/spotify/blob/f2845aa5788672b1d62fab139d6ae7b4bfc2d61b/auth.go#L172
This provides access to the access and refresh token which can be sent to your CLI side to make request to the API
I want to go in the reverse direction – my application will provide the tokens, and I want this library to accept them.
This will be resolved using functional options for the client instantiation in v2.0
I have an application that consists of two components: a persistent server that takes care of authenticating with Spotify (it stores creds and refreshes them after authenticating once), and a CLI that gets existing creds from this auth server and uses that token to make Spotify API calls. This lets me control Spotify from the command line without re-authenticating frequently. Currently the CLI portion of the app is written in Ruby while the server is in Go. I'm translating the CLI to Go right now and was hoping to use this library. However, the implementation of the
Client
struct here won't let me bypass this library's auth mechanism. I believe I could use this library if theClient.http
field was public – I would create my own client with anhttp.RoundTripper
that simply adds the authorization field.Any chance these fields could be exposed?