【发布时间】:2020-12-27 19:19:50
【问题描述】:
我一直在浏览 AWS Amplify docs and tutorials,了解如何与未经身份验证的用户一起使用 Amplify 和 Cognito 身份池。 Amplify 文档给出的示例是:
Amplify.Auth.fetchAuthSession(
result -> {
AWSCognitoAuthSession cognitoAuthSession = (AWSCognitoAuthSession) result;
switch(cognitoAuthSession.getIdentityId().getType()) {
case SUCCESS:
Log.i("AuthQuickStart", "IdentityId: " + cognitoAuthSession.getIdentityId().getValue());
break;
case FAILURE:
Log.i("AuthQuickStart", "IdentityId not present because: " + cognitoAuthSession.getIdentityId().getError().toString());
}
},
error -> Log.e("AuthQuickStart", error.toString())
);
但实际上,当我使用此代码时 - 我在 LogCat 中打印出一个错误:
AuthQuickStart: FAILURE IdentityId not present because: AmplifyException {message=You are currently signed out., cause=null, recoverySuggestion=Please sign in and reattempt the operation.}
注意:我确实将 AWS Cognito 配置为支持未经身份验证的用户!
我还到处寻找 Amplify Android API 文档以查看支持哪些其他 API - 找不到任何 Android API 文档。
并查看 AWS Amplify.Auth 方法,我找不到任何处理未经身份验证的用户的函数
问题:
任何线索我如何使用 Amplify (Android) 并通过 AWS Cognito 为未经身份验证的用户获得 AWS 凭证???
【问题讨论】:
标签: android amazon-web-services amazon-cognito aws-amplify