mirror of
https://gitlab.com/RemixDev/deemix-js.git
synced 2024-12-28 02:16:08 +00:00
Auto refresh spotify access token when expired
This commit is contained in:
parent
faec1c1a02
commit
69c3076899
|
@ -426,6 +426,10 @@ class Spotify extends Plugin {
|
|||
this.sp.clientCredentialsGrant().then(
|
||||
(creds)=>{
|
||||
this.sp.setAccessToken(creds.body.access_token)
|
||||
// Need to get a new access_token when it expires
|
||||
setTimeout(()=>{
|
||||
this.checkCredentials()
|
||||
}, creds.body.expires_in*1000-10)
|
||||
this.enabled = true
|
||||
},
|
||||
()=>{
|
||||
|
|
Loading…
Reference in a new issue