android-sdk icon indicating copy to clipboard operation
android-sdk copied to clipboard

Invalid App ID on authentication when Spotify is already installed on device

Open DianeHu opened this issue 4 years ago • 5 comments

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:

  1. Following this tutorial for remote control/authorization: https://developer.spotify.com/documentation/android/quick-start/, implement basic auth flow
  2. 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
  3. Attempt auth by clicking button tied to activity invocation

Expected behaviour:

  1. 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.

DianeHu avatar May 16 '20 02:05 DianeHu

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 🤷‍♂️

snappdevelopment avatar Jun 01 '20 06:06 snappdevelopment

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).

mdelolmo avatar Jun 12 '20 08:06 mdelolmo

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:

araczkowski avatar Mar 20 '21 12:03 araczkowski

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 👍

khoitruongg avatar Jul 03 '21 06:07 khoitruongg

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.:)

khoitruongg avatar Jul 03 '21 06:07 khoitruongg