【问题标题】:Spotify Android SDK: INVALID_APP_IDSpotify Android SDK:INVALID_APP_ID
【发布时间】:2017-06-06 20:28:23
【问题描述】:
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() 返回 ERROR,且 response.getError() 为 INVALID_APP_ID。

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

PS:澄清一下,这不是Spotify API: INVALID_APP_ID的重复

帖子的回答是把SHA-1指纹和包名放在portal里面,不过我已经这样做了。

【问题讨论】:

  • 经常看到这个,人们假装它是“没有重复的”,以证明重复的问题;虽然很可能只是没有添加正确的(或两者)SHA-1 键指纹。

标签: java android spotify


【解决方案1】:

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

有关如何获取 SHA1 的帮助,请参阅 https://developers.google.com/android/guides/client-auth

【讨论】:

    猜你喜欢
    • 2021-09-27
    • 1970-01-01
    • 2017-10-31
    • 2011-07-12
    • 2012-10-18
    • 1970-01-01
    • 1970-01-01
    • 2015-04-15
    • 1970-01-01
    相关资源
    最近更新 更多