AWS Cognito Identiy - " {cognito-identity,us-east-2}未在区域元数据中找到"

时间:2017-08-03 18:50:46

标签: android amazon-web-services amazon-cognito aws-cognito

我尝试使用AWS Cognito Identity来创建用户。我正在关注这个(http://docs.aws.amazon.com/cognito/latest/developerguide/tutorial-integrating-user-pools-android.html)教程。

这是我的代码:`

public class testLogin扩展AppCompatActivity {

var t TextOutput
t = `Test test`
output, err := json.Marshal(t)
if err != nil {
    fmt.Println(err)
} else {
    fmt.Println(string(output))
}
// prints Test Test. Expected {"data": "Test test"}

}`

以下是Android Monitor输出的内容:



ClientConfiguration clientConfiguration = new ClientConfiguration();
String clientId = "########################";
String poolId = "############";
String clientSecret = "###############################";

CognitoUserPool userPool;


@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.test_login);

    userPool = new CognitoUserPool(getApplicationContext(), poolId, clientId, clientSecret, clientConfiguration);

    CognitoUserAttributes userAttributes = new CognitoUserAttributes();
    userAttributes.addAttribute("given_name", "test");
    userAttributes.addAttribute("email", "testEmail@gmail.com");

    userPool.signUpInBackground("testUserName", "TestPW2!#", userAttributes, null, signupCallback);

}
SignUpHandler signupCallback = new SignUpHandler() {

    @Override
    public void onSuccess(CognitoUser cognitoUser, boolean userConfirmed, CognitoUserCodeDeliveryDetails cognitoUserCodeDeliveryDetails) {
        // Sign-up was successful

        // Check if this user (cognitoUser) needs to be confirmed
        if(!userConfirmed) {
            // This user must be confirmed and a confirmation code was sent to the user
            // cognitoUserCodeDeliveryDetails will indicate where the confirmation code was sent
            // Get the confirmation code from user
        }
        else {
            // The user has already been confirmed
        }
    }

    @Override
    public void onFailure(Exception exception) {
        // Sign-up failed, check exception for the cause
    }
};




如何修复此错误:"我/ AmazonWebServiceClient:在区域元数据中找不到{cognito-sync,us-east-2} ..."

我当前的代码不会将新用户(或任何内容)添加到我的用户池中。

0 个答案:

没有答案