What happened
SmapiClient does not refresh token
What did you expect to happen
SmapiClient should take the new token when faultstring is tokenRefreshRequired
How to reproduce it (minimal and precise)
Use Spotify service, wait for some time to call again some getMetada
Debug logging
See faultCode is not a string but an object, what the class is looking for is into #text
sonos:smapi:Spotify Soap error getMetadata { faultcode: { '#text': 'ns0:Client.TokenRefreshRequired' }, faultstring: { lang: 'en', '#text': 'tokenRefreshRequired' }, ...
changing all conditions to err.Fault.faultstring['#text'] === SmapiClientErrors.TokenRefreshRequiredError seems to fix the issue on my side, but is it specific to Spotify ? or my env ?
Environment
- sonos-ts version: 2.6.0-beta.11
- OS: Ubuntu 22
- node version (
node -v): v20.17.0
Checklist
Please confirm the following before creating the issue.
What happened
SmapiClientdoes not refresh tokenWhat did you expect to happen
SmapiClientshould take the new token when faultstring istokenRefreshRequiredHow to reproduce it (minimal and precise)
Use Spotify service, wait for some time to call again some getMetada
Debug logging
See faultCode is not a string but an object, what the class is looking for is into #text
sonos:smapi:Spotify Soap error getMetadata { faultcode: { '#text': 'ns0:Client.TokenRefreshRequired' }, faultstring: { lang: 'en', '#text': 'tokenRefreshRequired' }, ...changing all conditions to
err.Fault.faultstring['#text'] === SmapiClientErrors.TokenRefreshRequiredErrorseems to fix the issue on my side, but is it specific to Spotify ? or my env ?Environment
node -v): v20.17.0Checklist
Please confirm the following before creating the issue.