spotify / web-playback-sdk

This issue tracker is no longer used. Join us in the Spotify for Developers forum for support with the Spotify Web Playback SDK ➡️ https://community.spotify.com/t5/Spotify-for-Developers/bd-p/Spotify_Developer
106 stars 7 forks source link

Get SDK token automatically after 1 hour #108

Open dennisfrijlink opened 4 years ago

dennisfrijlink commented 4 years ago

Is it possible to make a request for a new web playback SDK access token after the old one expired without going to the developer site from Spotify? I use the web playback SDK very much and I love the way it works but I can't find a way to automatically make a request for a new one.

UlysseM commented 4 years ago

Have a look at the doc: https://developer.spotify.com/documentation/general/guides/authorization-guide/

I'd suggest you to use use the Authorization code approach, as you end up getting a refresh token that you can use to generate token.

When creating "new window.Spotify.Player", the callback passed to getOAuthToken can then ask your server for a new token.

dennisfrijlink commented 4 years ago

Is an example possible?