final AuthenticationRequest request = new AuthenticationRequest.Builder(CLIENT_ID, AuthenticationResponse.Type.TOKEN, REDIRECT_URI)
.setScopes(new String[]{"playlist-read"})
.build();
AuthenticationClient.openLoginActivity(this, REQUEST_CODE, request);
The above is the code that is run once the login button is clicked. This code works fine when run on an emulator. Below is the onActivityResult:
if (requestCode == REQUEST_CODE) {
AuthenticationResponse response = AuthenticationClient.getResponse(resultCode, intent);
switch (response.getType()) {
// Response was successful and contains auth token
case TOKEN:
logMessage("Got token: " + response.getAccessToken());
CredentialsHandler.setToken(this, response.getAccessToken(), response.getExpiresIn(), TimeUnit.SECONDS);
startMainActivity(response.getAccessToken());
break;
// Auth flow returned an error
case ERROR:
logError("Auth error: " + response.getError());
break;
// Most likely auth flow was cancelled
default:
logError("Auth result: " + response.getType());
}
}
When the app is run on a device that HAS the Spotify App installed, response.getType() returns ERROR with response.getError() being INVALID_APP_ID.
My app's package name and SHA-1 fingerprint is entered in the dev portal in Spotify, and that shouldn't be the problem since it works on an emulator. Why isn't the token being sent in the response? Thanks in advance!
PS: To clarify, this is NOT a duplicate of Spotify API: INVALID_APP_ID
The post's answer is to put the SHA-1 fingerprint and package name in the portal, but I have already done that.