Plan
Premium
Country
India
Device
Xiaomi Mi A3, Google Pixel 6a, Emulator
Operating System
Android 13, 14
My Question or Issue
I want to create an app for personal use that can control playback in Spotify. So I tried to use the app remote SDK (https://github.com/spotify/android-sdk). The sample app works fine, it opens Spotify for authorization, and I can successfully control Spotify playback through the sample app.
But if I try to use my own client id and callback URLs, it simply fails with UserNotAuthorized error in the logs, and doesn't even open up the prompt for consenting to the authorization. I registered the same callback URL in the app settings in the developer dashboard too, so I don't think it's a callback URL mismatch issue.
The same thing happens with the auth-lib sample too. But when I go the the URL that is used to make the auth request (as it is logged), it opens fine in the browser. I'm really lost of what's happening here, there are a few questions I have:
1. Why is my client app not working, but Spotify's test app is? I ensured the client id and callback URL are all as per configured in the app?
2. What does the callback URL even do in the context of Android? The sample app uses "comspotifytestsdk://callback" as the callback URL, but the scheme is not registered in the manifest. So how does the Spotify app know where to redirect?
3. I tried using the same callback URL "comspotifytestsdk://callback" for my app as well, but that also doesn't work.
The exact error that is logged:
Connection failed.
com.spotify.protocol.client.error.RemoteClientException: {"message":"Explicit user authorization is required to use Spotify. The user has to complete the auth-flow to allow the app to use Spotify on their behalf"}
at com.spotify.protocol.client.RemoteWampClient.getRemoteClientException(RemoteWampClient.java:130)
at com.spotify.protocol.client.RemoteWampClient.access$200(RemoteWampClient.java:16)
at com.spotify.protocol.client.RemoteWampClient$1.onAbort(RemoteWampClient.java:43)
at com.spotify.protocol.client.WampRouterImpl.routeAbort(WampRouterImpl.java:100)
at com.spotify.protocol.client.WampRouterImpl.route(WampRouterImpl.java:26)
at com.spotify.protocol.client.AppProtocolCommunicator.onData(AppProtocolCommunicator.java:77)
at com.spotify.android.appremote.internal.RemoteServiceIo.handleMessage(RemoteServiceIo.java:108)
at com.spotify.android.appremote.internal.RemoteServiceIo.access$000(RemoteServiceIo.java:45)
at com.spotify.android.appremote.internal.RemoteServiceIo$IncomingHandler.handleMessage(RemoteServiceIo.java:86)