Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android SDK Auth Window Not Showing up #356

Open
vivianofsouza opened this issue Feb 4, 2024 · 1 comment
Open

Android SDK Auth Window Not Showing up #356

vivianofsouza opened this issue Feb 4, 2024 · 1 comment

Comments

@vivianofsouza
Copy link

Issue found on 2/3/2024.

SDK Version: 0.8.0

OS Version: Android API 34 (Using an Android Emulator)

Scope(s): app-remote-control

Steps to reproduce:

  1. I followed the instructions from here, in order to import the app-remote-lib and set up authentication to Spotify Remote

  2. However, I'm not able to authenticate my app with the app-remote. I followed the code in this link. I put this in my MainActivity.java of my React app:
    `protected void onStart() {
    ConnectionParams connectionParams =
    new ConnectionParams.Builder(CLIENT_ID)
    .setRedirectUri(REDIRECT_URI)
    .showAuthView(true)
    .build();

     SpotifyAppRemote.connect(this, connectionParams,
         new Connector.ConnectionListener() {
    
           @Override
           public void onConnected(SpotifyAppRemote spotifyAppRemote) {
             mSpotifyAppRemote = spotifyAppRemote;
             Log.d("MainActivity", "Connected! Yay!");
             // Now you can start interacting with App Remote
             connected();
           }
    
           @Override
           public void onFailure(Throwable throwable) {
             Log.e("MainActivity", throwable.getMessage(), throwable);
             // Something went wrong when attempting to connect! Handle errors here
           }
         });`
    

But when I open my app, nothing appears and in my logs I keep getting this error:
{"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"}

I have Spotify installed on the emulator and am logged-in on that. I am also using the Web API SDK in other parts of the React project. so I added the scope 'app-remote-control' to the part where I request authentication and access for the Web API SDK. When I did that, I saw a pop-up screen that asked me to agree to the new scopes, but the app-remote still displayed the same message.

Any help would be much appreciated! Thanks in advance!

Expected behaviour:

To be able to authenticate to spotify remote and use the Spotify Remote Player.

Actual behaviour:

Getting error that Explicit user auth is required, no auth window shows up.

@goodluck3301
Copy link

goodluck3301 commented Feb 7, 2024

You must fill in these fields

  • SH1 key

  • redirect url

  • application package name

    private val clientId = "d1125159a****************"
    private val redirectUri = "https://com.spotify.tv.android.spotifysdkkotlindemo/callback"
    private var spotifyAppRemote: SpotifyAppRemote? = null
    
        val connectionParams = ConnectionParams.Builder(clientId)
            .setRedirectUri(redirectUri)
            .showAuthView(true)
            .build()
    
        SpotifyAppRemote.connect(requireContext(), connectionParams, object : Connector.ConnectionListener {
            override fun onConnected(appRemote: SpotifyAppRemote) {
                spotifyAppRemote = appRemote
                Log.e("SpotifyLogs", "Connected! Yay!")
                connected()
            }
    
            override fun onFailure(throwable: Throwable) {
                Log.e("SpotifyLogs", throwable.message, throwable)
            }
        })
    
    private fun connected() {
        spotifyAppRemote?.let {
            val playlistURI = "spotify:track:3gVhsZtseYtY1fMuyYq06F"
            it.playerApi.play(playlistURI)
            it.playerApi.subscribeToPlayerState().setEventCallback {
                val track: Track = it.track
                Log.d("MainActivity", track.name + " by " + track.artist.name)
            }
        }
    }```
    

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants