首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >当尝试通过API Gateway从getTokens检索数据时收到错误“AWS不支持在签名时检索令牌”

当尝试通过API Gateway从getTokens检索数据时收到错误“AWS不支持在签名时检索令牌”
EN

Stack Overflow用户
提问于 2019-08-08 18:35:18
回答 1查看 253关注 0票数 1

问题:

控制台显示"getTokens不支持在签名时检索令牌-“错误。步骤: 1.使用Android studio运行应用2.登录AWS (我的应用使用amplify插件UI ) 3.通过API Gateway从AWS检索数据--> result OK (能够检索) 4.注销并重新登录5.通过API Gateway --> result NG从AWS检索数据(显示上面的错误)

代码语言:javascript
复制
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());
        }
    }
}
EN

回答 1

Stack Overflow用户

发布于 2020-12-22 21:51:21

我猜错误的结尾是"getTokens不支持在签名时检索令牌“--...out?我遇到了类似的错误,请在app -> src -> res -> raw -> amplifyconfiguration.json & awsconfiguration.json中检查您的identity poolId是否正确(即使您没有使用guest访问或只想使用用户池功能)。您可以在您的亚马逊网络服务控制台中找到您的poolId -> ->管理身份池->单击您的池->单击示例代码:

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/57410624

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档