fusion
fusion copied to clipboard
Integration for fetching user music listening history
We already have a flow to:
-
authenticate a user account and fetch recently played songs for a user
-
process and return the features of songs a user is listening to
We should integrate an OAuth flow to the spotify api that allows us to fetch listening history for a user periodically and update:
- [ ] on the settings page, user connects account
- [ ] client sends token to the backend server to store in keystore
- [ ] adds a controller endpoint to periodically fetch from spotify on behalf of user
- [ ] call the upload api to store data for user
https://github.com/dgendill/spotify-play-history has a good javascript example for connecting to spoify api and fetching periodically.
Data should be stored in remote blob (if user consents) - <userGuid>/y/m/d/<unixTimestamp>-listening_history.json
https://developer.spotify.com/documentation/web-api/reference/get-recently-played
Fell off the wagon here but I'm back now, I'll make a PR later tonight with the backend pieces for this : https://developer.spotify.com/documentation/web-api/tutorials/code-flow