【发布时间】: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键指纹。