Skip to content

BUG: SmapiClient does not store new token on tokenRefreshRequired fault #200

@grougy

Description

@grougy

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.

  • Environment specified
  • Checked issues for duplicates
  • Debug log added

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions