Skip to content

AuthorizationManager should deauthorize if app access was removed via Spotify #72

@Mohamad-Kredly

Description

@Mohamad-Kredly

While looking into Issue #71, I ran into a new issue after revoking the app's access from Spotify Account -> Manage Apps (https://www.spotify.com/ca-en/account/apps/).

What happens here is that the refresh token is revoked, but the package doesn't handle this error which leads to a negative UX when the user wants to sign in again and naturally, the API calls will be running into errors. The access token, however, remains valid till it expires.

Encountered with AuthCodeFlowManager (proxy and client), untested with other auth methods.

Log Trace

[spotifyDecode: trace: decodeSpotifyErrors(data:httpURLResponse:) line 67] will try to decode data from URL 'https://accounts.spotify.com/api/token' into error objects:
{"error":"invalid_grant","error_description":"Refresh token revoked"}
refresh tokens completion: failure(SpotifyWebAPI.SpotifyAuthenticationError(error: "invalid_grant", errorDescription: Optional("Refresh token revoked")))

Steps to reproduce

  1. Authorize Spotify
  2. Go to https://www.spotify.com/ca-en/account/apps/ and remove the app's access
  3. Attempt to refresh the token

This will also be reflected when restarting the app and seeing the log out button instead of sign in when token has expired

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions