android-sdk
android-sdk copied to clipboard
Invalid App ID on authentication when Spotify is already installed on device
Issue found on 5/14/2020.
SDK Version: spotify-app-remote-release-0.7.0, spotify-auth-release-1.2.3
OS Version: MacOS Catalina, running a Pixel 3 emulator
Scope(s): app-remote-control
Steps to reproduce:
- Following this tutorial for remote control/authorization: https://developer.spotify.com/documentation/android/quick-start/, implement basic auth flow
- Launch on android emulator in Android Studio 3.6.3 on MacOS Catalina, with emulator having Spotify either installed and logged in, or just installed and not logged in
- Attempt auth by clicking button tied to activity invocation
Expected behaviour:
- Should receive an auth token per the tutorial
Actual behaviour:
When Spotify isn't installed on the emulator, a token is produced as expected. When Spotify is installed, regardless of login status, INVALID_APP_ID error is thrown and auth fails. This error is not thrown when Spotify isn't installed, and I've checked and rechecked that my app id in my application dashboard is correct and saved. This behavior also happens on a physical device.
Is there something wrong with the current tutorial's way of doing it? I'm using the code from there basically copy pasted.
Check out this issue, maybe it helps: https://github.com/spotify/android-sdk/issues/188
I had the same problem and I saw that I had
debug { applicationIdSuffix ".debug" }
in my build.gradle file.
So the package in the dashboard should be <myPackageName>.debug
On the other hand, there is no way to refresh the token silently, so I can't use the sdk anyway 🤷♂️
Hi,
When Spotify is installed, the authorization flow is run natively. This native authorization flow checks for your app's package id and the signature fingerprint. If those don't match (and they need to match exactly) those you entered in the developer console, you'll get a INVALID_APP_ID
.
Like @snappdevelopment pointed out, you need to add both your debug build and release configurations including their package ids and signatures (case sensitive).
Hi @mdelolmo
the is some strange problem with this, I'm 100% sure that I'm using correct ConnectionParams (package id, client id and redirect uri) the signature fingerprint is correct too -> SHA1 uppercase. But each time when my app is reinstalled (during the upgrade) I have a error -> {"message":"Client authentication failed:INVALID_APP_ID"}
The workaround is to logout from spotify app and login again. After this all works again OK... until my app is upgraded again. Could you please check this. This is not designed behavior... I assume. Thanks and Have a good day :+1:
Hi, i'm facing same issue. if Spotify is not installed on my device, it will prompt Login page and i can login successfully, so i don't think this is problem with config on Spotify developer dashboard.
Hi @mdelolmo
the is some strange problem with this, I'm 100% sure that I'm using correct ConnectionParams (package id, client id and redirect uri) the signature fingerprint is correct too -> SHA1 uppercase. But each time when my app is reinstalled (during the upgrade) I have a error -> {"message":"Client authentication failed:INVALID_APP_ID"}
The workaround is to logout from spotify app and login again. After this all works again OK... until my app is upgraded again. Could you please check this. This is not designed behavior... I assume. Thanks and Have a good day 👍
Oh, after searching, i found that my SHA key has some lower-case character, i changed it to Uppercase and it works as expected now.:)