I’m experiencing an issue when logging into Spotify within my Android application. Every time I try to log in through the Spotify app, it throws an AUTHENTICATION_SERVICE_UNAVAILABLE error. On the other hand, if the Spotify app gets uninstalled, logging in through the browser works smoothly. I would prefer users to log in directly via the Spotify app if it’s available on their device.
public void startSpotifyLogin(boolean attemptAgain) {
this.attemptAgain = attemptAgain;
AuthorizationRequest.Builder requestBuilder =
new AuthorizationRequest.Builder(CLIENT_ID, AuthorizationResponse.Type.TOKEN, REDIRECT_URI);
requestBuilder.setScopes(new String[]{"user-read-private", "streaming", "playlist-read-private", "user-library-read"});
AuthorizationRequest authRequest = requestBuilder.build();
AuthorizationClient.openLoginActivity(this, SPOTIFY_LOGIN_REQUEST_CODE, authRequest);
}
When the error occurs, the log details are:
2021-12-22 11:36:29.802 5069-5069/? I/com.spotify.sdk.android.auth.LoginActivity: Spotify auth completing. The response is in EXTRA with key 'response'
2021-12-22 11:36:29.822 5069-5069/? D/StartActivity: Spotify error: AUTHENTICATION_SERVICE_UNAVAILABLE
Has anyone faced this before? I would appreciate any insights!