java - Spotify 安卓 SDK : INVALID_APP_ID

标签 java android spotify

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

上面是点击登录按钮后运行的代码。此代码在模拟器上运行时运行良好。下面是 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());
        }
    }

当应用程序在安装了 Spotify 应用程序的设备上运行时,response.getType() 返回错误,response.getError() 为 INVALID_APP_ID。

我的应用程序包名称和 SHA-1 指纹在 Spotify 的开发门户中输入,这应该不是问题,因为它可以在模拟器上运行。为什么不在响应中发送 token ?提前致谢!

PS:澄清一下,这不是 Spotify API: INVALID_APP_ID 的副本

帖子的回答是把SHA-1指纹和包名放到portal里,我已经这么做了。

最佳答案

您应该在 https://developer.spotify.com/dashboard/ 上的项目设置中添加(调试和发布)SHA1 指纹和包名.

参见 https://developers.google.com/android/guides/client-auth寻求有关如何获取 SHA1 的帮助。

关于java - Spotify 安卓 SDK : INVALID_APP_ID,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41787548/

相关文章:

带有垂直文本的 java swing 单选按钮

java - com.spotify.docker.client.DockerRequestException : Request error: DELETE unix://localhost:80/v1. 12/容器/...:409

android - 为包过滤 BOOT RECEIVER

Android 应用计费 v3 错误

java - 如何对具有多个条件的列表进行排序?

ios - CocoaLibSpotify - 接收远程控制事件并设置正在播放信息

android - 适用于 Android 的 Spotify API/ADK

java - 解析足球队和结果

java - 提取字符串的设备名称

java - 在 Swing 中取消表更新事件