@volumio @marco_volumio
Ok, so I’ve dug more into this. Not having the source for the tidal streaming stuff makes it difficult.
When you do an initial token fetch, the API returns an access token, and an expiry time. However, the code does nothing with the expiry time other than make a note of it.
You then set up some code to refresh the token every 12 hours (I think).
I’m guessing that the TIDAL api has recently changed to timeout tokens quicker than that. Although debugging is difficult, it’s not impossible, and I can see that the token timeout is now 1 hour.
All the example code on the TIDAL dev site uses 24 hour token expiry, which leads me to think that’s what it used to be.
You should change the timeout to be set according to the value stored in tokenExpirationTime when the token refresh is called, rather than just a blanket 12 hours.
– Edit to add
Of course, although it would require a fairly large re-architecting of the TIDAL code, it should be able to detect that a ‘Token has timed out’ result has been returned, refresh the token and try again automatically.
– Edit again to add
Actually, looking into this more, the way the TIDAL SDK does it is a good approach. Make the access token be returned by a method, rather than it being a variable. Then check if the token is expired and refresh it then if needed.
Not quite as robust as an automatic retry if the call fails with a token error. You could invalidate the token if you get an error and then refresh it if the token is invalid on the next call.
I’ll stop getting frustrated over code I can’t fix myself now.
Please fix this soon, I’m still in my trial period for Volumio premium, and this isn’t a great experience.
– Edit the next day (12 Nov)
Just updated to 4.067. After the reboot I logged into Tidal and started a long playlist. It stopped working after an hour, so I think my findings about the token expiring after an hour are correct.