mental32 / spotify.py

🌐 API wrapper for Spotify 🎶
https://spotifypy.readthedocs.io/en/latest/
MIT License
150 stars 38 forks source link

Improve handling of refresh tokens #23

Closed mikonse closed 4 years ago

mikonse commented 4 years ago

I came across the use case of wanting to instantiate a spotify user solely from a refresh token when restarting an application. This means we can save the refresh token to a config file (or something else) and not need to authenticate with spotify on every restart. Saving the access token is not enough as it is not valid for very long.

Another use case is that I wanted to be able to access the refresh token after authenticating with spotify via http callback so that only one authentication is required, the refresh token can be saved and later on allow for application restarts without a new OAuth flow.

mental32 commented 4 years ago

This sounds very reasonable, have the changes been tested?

mikonse commented 4 years ago

Yes, tested them manually and they work fine and as intended.