Initially I had thought it would make sense to set the refresh token to null if token exchange failed. However, sometimes pinpoint would send two requests to Spotify with the same old access token, triggering two token exchanges. The second exchange would fail as Spotify invalidates the refresh token on each exchange, and the refresh token in settings would be set to null.
Also added a bit more error handling for parsing JSON results just to be safe.
Initially I had thought it would make sense to set the refresh token to null if token exchange failed. However, sometimes pinpoint would send two requests to Spotify with the same old access token, triggering two token exchanges. The second exchange would fail as Spotify invalidates the refresh token on each exchange, and the refresh token in settings would be set to null. Also added a bit more error handling for parsing JSON results just to be safe.