Type in your question below and we'll check to see what answers we can find...
Loading article...
Submitting...
If you couldn't find any answers in the previous step then we need to post your question in the community and wait for someone to respond. You'll be notified when that happens.
Simply add some detail to your question and refine the title if needed, choose the relevant category, then post.
Before we can post your question we need you to quickly make an account (or sign in if you already have one).
Don't worry - it's quick and painless! Just click below, and once you're logged in we'll bring you right back here and post your question. We'll remember what you've already typed in so you won't have to do it again.
Hello,
I'm developing a personal website/developer profile and I'd like to display some user data from my own profile. Specifically, I'd like to display my all-time most listened to tracks and artists.
Is there a way to display this information on my website and keep it up to date without asking a user to login?
Thanks!
No, you cannot retrieve user data without asking the user to login. That would be a massive privacy violation.
It's not a possibility to do it programmatically in the frontend since you also would need to expose your login credentials. You might be able to build a backend which can authorize and get you an access token, you could then get your user stats and create an API endpoint that your personal website could call with a fetch request. You can read more about authorization flows here: https://developer.spotify.com/documentation/general/guides/authorization-guide/
No. Read the authorization guide. You only need to login once so this should not be an issue.
Hey, were you able to get this done, I've been trying to do the same thing for weeks, all I see is having to tap into the user's account, but i wanna programmatically log into mine for any user that uses my app and pull data from my own account for them
You have to make a server side script that refreshes the access token with the refresh token when it expires. When the refresh token expires, you will get a new one while refreshing. (If it isn't expired, you will not get a new one.)
but is it possible to get the access and refresh tokens without taking the user through login, I mean I know I could use the client_credentials and get an access && refreshToken with just my clientId and secret, but will that give me access to "user-scoped functions" like getting user's currentPlayingTrack, where that user is ME, my account, the account from which I go the clientId and secret
@CrossDeveloper, You have to log in once to get the Authorization Code Flow with the necessary scopes. If you do this, you will get the necessary tokens automatically, and store those onto your server.
Ohhhhh makes sense now🤓 so i can just do the login now and get the tokens then use them for any other requests the user makes, then if the refresh token should expire, I could still redo the auth server side and replace the old token and just like that, Thanks a lot, makes sense now
Hey there you, Yeah, you! 😁 Welcome - we're glad you joined the Spotify Community! While you here, let's have a fun game and get…