问题:
控制台显示"getTokens不支持在签名时检索令牌-“错误。步骤: 1.使用Android studio运行应用2.登录AWS (我的应用使用amplify插件UI ) 3.通过API Gateway从AWS检索数据--> result OK (能够检索) 4.注销并重新登录5.通过API Gateway --> result NG从AWS检索数据(显示上面的错误)
note:
my configuration file include: Cognito User pool and Identity pool. this is auto generate after keyin " amplify add auth" at CLI.
if i deleted Cognito Identity pool from configuration file, issue not happen.
May i know why ?
my configuration file:
{
"UserAgent": "aws-amplify-cli/0.1.0",
"Version": "1.0",
"IdentityManager": {
"Default": {}
},
"CredentialsProvider": {
"CognitoIdentity": {
"Default": {
"PoolId": "xxx",
"Region": "us-east-2"
}
}
},
"CognitoUserPool": {
"Default": {
"PoolId": "us-east-2_xxx",
"AppClientId": "xxx",
"AppClientSecret": "xxx",
"Region": "us-east-2"
}
}
}
sign-in code:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_authentication);
AWSMobileClient.getInstance().initialize(getApplicationContext(), new Callback<UserStateDetails>() {
@Override
public void onResult(UserStateDetails userStateDetails) {
switch (userStateDetails.getUserState()) {
case SIGNED_IN:
Intent i = new Intent(Authentication.this, AvailableFlavor.class);
break;
case SIGNED_OUT:
showSignIn();
break;
default:
AWSMobileClient.getInstance().signOut();
showSignIn();
break;
}
}
@Override
public void onError(Exception e) {
}
});
}
private void showSignIn() {
try {
AWSMobileClient.getInstance().showSignIn(this,
SignInUIOptions.builder().nextActivity(LoginSuccess.class)
.build());
} catch (Exception e) {
// Log.e(TAG, e.toString());
}
}
}发布于 2020-12-22 21:51:21
我猜错误的结尾是"getTokens不支持在签名时检索令牌“--...out?我遇到了类似的错误,请在app -> src -> res -> raw -> amplifyconfiguration.json & awsconfiguration.json中检查您的identity poolId是否正确(即使您没有使用guest访问或只想使用用户池功能)。您可以在您的亚马逊网络服务控制台中找到您的poolId -> ->管理身份池->单击您的池->单击示例代码:

https://stackoverflow.com/questions/57410624
复制相似问题