0

Im using flutter with the Amazo Cognito Identiy Dart Plugin

I am new to AWS and followed the sample code provided on the plugin's github page to create a new user but I keep getting the following error message:

    CognitoClientException{statusCode: null, code: NetworkError, name: null, message: Failed host lookup: 'cognito-idp.us-east-1.amazonaws.com'}

I have read through a good chunck of the complete sample app and can't seem to find what I am overlooking. I thought that maybe I needed to include the android permission for internet (although the documentation didn't mention it); however I still got the same error code.

Below is the code for the method to sign up a new user. The variables cognitoUserPoolId and cognitoClientId are from a secret.dart file, and reference my user pool. The user pool allows users to sign up with a name, email address, and password. Besides that it uses the default settings.

final userPool = new CognitoUserPool(cognitoUserPoolId, cognitoClientId);

  signUpUser(String name, String email, String password) async {

    final userAttributes = [
      new AttributeArg(name: 'name', value: name),
    ];

    var data;
    try {
      print('attempting to sign user up');
      data = await userPool.signUp(email, password, userAttributes: userAttributes);
    } catch (e) {
      print(e);
    }
  }

Edit: turns out what I was reading was the source code of the plugin, and not the example app. According to the example it seems that the uses-internet permission is actually required. Unfortunately as I stated earlier adding it did not fix the problem.

1 Answers1

0

Update: I have found the solution. It turns out the emulator I was runnning was having issues connecting to the network. Stack Overflow question detailing how to fix that issue

I simply used a physical device and all seems to be working great!