I am currently developing a mobile application that uses Spotify integration, as you may know when authenticating with spotify we receive an access token and a refresh token, the first one expires after an hour and the second one is used to request a new token.
From my mobile application I request the user to give me permissions to his spotify account, therefore, he enters his credentials and I receive the access token, refresh token and calculate at the time it will expire. These values are stored in my database in a secure way and are associated to the user, also they are used by my backend where I have a scheduled task that is responsible for automatically refresh the access tokens in case they are close to expire, to achieve this I must use the refresh token and the request responsible for doing so sometimes responds with these errors:
- Failed to remove token
- ECONNRESET
Therefore, the refresh token is revoked and my scheduled task cannot update the access token anymore.
Does anyone know why these errors occur?
So far I have tried to downgrade the node version to 14.18, but it doesn't work.
I hope that the error mentioned above will not appear and allow me to refresh the token.