Announcements

Help Wizard

Step 1

NEXT STEP

FAQs

Please see below the most popular frequently asked questions.

Loading article...

Loading faqs...

VIEW ALL

Ongoing Issues

Please see below the current ongoing issues which are under investigation.

Loading issue...

Loading ongoing issues...

VIEW ALL

Building a website widget to display my recent favs

Building a website widget to display my recent favs

I have found an endpoint I would like to call on my personal website to simply display my recent favorites on spotify. The authorization code auth flow seems like the right choice for this scenario, however it's not clear to me how the auth flow should work for this, because I want to authorize it for my personal account only, and just once. Whenever the site loads, I want it get my most recent favorites. 

 

I'm figured I will need to create a server side endpoint to call the spotify api, then my client will call my endpoint. But do I need to build an entire auth/redirect flow for this? Again I am the only one who will need auth for it. Then it just displays my favorites to users.  How to build something like this?

Reply
4 Replies

I spent a lot of time investigating this so I wanted to share my findings. Spotify doesn't really support this use case unfortunately. The authorization code flow is the necessary flow - it grants an access token that lasts an hour. For this to work in a website as a static display, you need to persist the access and refresh tokens in a DB. This is a bit impractical because they will constantly need to be refreshed. So many calls will also include the token refresh call. I don't think it's worth all the requests and infrastructure.

Thanks for sharing.

You can choose to only refresh the top songs on your site after ond or more hours or a day (and store them in a database). Then you only need to request a refreshed access token and your to songs once every cycle.

 

XimzendSpotify Star
Help others find this answer and click "Accept as Solution".
If you appreciate my answer, maybe give me a Like.
Note: I'm not a Spotify employee.

I am very interested in this, did you find any other solution?

Suggested posts

Staff
Let's introduce ourselves!

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…

Staff
ModeratorStaff / Moderator/ 3 years ago  in Social & Random

Type a product name