Hi there. I’m just wondering if anyone has any experience of getting authentication tokens from Spotify. Whether through spotify directly, Spotipy, or tekore.
I’ve an app that runs locally with the Spotify API that relies on access to the user’s info, so it needs that authentication. My issue is that when I try to run it on Heroku the app doesn’t work. I think it has to do with the redirect URL. In that server authentication is different to getting authentication locally.
I know this isn’t really related to streamlit, so it’s more just a hope that maybe someone here has worked with the Spotify for any help.
Thanks!
Hi @29f3j092j3f0j -
I’ve not done it myself, but I’ve seen other apps that have been able to work against the Spotify API. Usually what you want to do with APIs is set up credentials using a service account, which lets you get values programmatically instead of requiring you to do authentication via the browser.
But as I’ve said, I’ve never done it. Hopefully someone stops by who can give you the real answer 
Best,
Randy
Thanks. Yep hopefully!
There are different levels of authentication with Spotify, you can use the API with just a client credential, but if you want to interact with user data you have to get a token, which I’m not sure I can do with streamlit. I’ll keep looking though!
1 Like
I am also trying to get Spotify OAuth to work for external users who visit my Streamlit app. I have been able to get this to work on a local development server, but when I deploy to Heroku, it says the port is already in use, which is a pretty vague error message that tells me the web sockets are not binding correctly due to the authorization flow.
I was trying to mimic the authorization flow for Flask apps in Streamlit (https://stackoverflow.com/questions/26726165/python-spotify-oauth-flow) because Flask has really good documentation on this, but Streamlit is a bit different in terms of the way it handles redirects. Would love to get this working so that users can export songs to new playlists of their own through my app!
Thanks in advance for any help anyone can provide on this.
2 Likes
I still haven’t solved this unfortunately.
Have you looked at tekore?
I’ve been meaning to have a look at this again, but it might not be possible to generate a token with the required scope with streamlit; that it needs a server backend for the redirect?
Hey Sage!
I’m facing the same issue
- Did you find a workaround for it in the end?
Thanks
Charly
I never found a work around unfortunately.
Ironically, I have been beating my head over this for a couple days on/off.
I can’t seem to catch the access token code on the redirect. I’ve been trying spotipy and tekore, no luck on either!
I’m using spotipy and can’t even get the redirect to happen. Definitely an annoying problem, no solution yet?