aws-sdk-android icon indicating copy to clipboard operation
aws-sdk-android copied to clipboard

AWSMobileClient signUp action for new users is not allowed when no app client secret is configured userpool

Open suandplzop opened this issue 8 years ago • 4 comments

State your question When sign up a new user to no appclient secret configured userpool, i get the exception snippets below.

App client secret is allowed in Android sdk, but the
CognitoUserPool(Context context, AWSConfiguration awsConfiguration) constructor read key AppClientSecret will always opt with empty string if AppClientSecret not set in configuration.json.

Which AWS Services are you utilizing?

com.amazonaws.mobile.client.AWSMobileClient

Provide code snippets (if applicable)

11-21 17:40:43.568 24637-26276/com.softchef.androidlab D/LoginFragment$onActivit: java.lang.IllegalArgumentException: key.length == 0
        at javax.crypto.spec.SecretKeySpec.<init>(SecretKeySpec.java:62)
        at com.amazonaws.mobileconnectors.cognitoidentityprovider.util.CognitoSecretHash.getSecretHash(CognitoSecretHash.java:57)
        at com.amazonaws.mobileconnectors.cognitoidentityprovider.CognitoUserPool.signUpInternal(CognitoUserPool.java:416)
        at com.amazonaws.mobileconnectors.cognitoidentityprovider.CognitoUserPool.signUp(CognitoUserPool.java:378)
        at com.amazonaws.mobile.client.AWSMobileClient$7.run(AWSMobileClient.java:1093)
        at com.amazonaws.mobile.client.internal.InternalCallback$1.run(InternalCallback.java:101)
        at java.lang.Thread.run(Thread.java:818)

And i manual setup the aws configuration.json file with:

{
  "IdentityManager": {
    "Default": {}
  },
  "CredentialsProvider": {
    "CognitoIdentity": {
      "Default": {
        "PoolId": "ap-southeast-1:xxxxxxxxxxxxxxxxxxxxx",
        "Region": "ap-southeast-1"
      }
    }
  },
  "CognitoUserPool": {
    "Default": {
      "PoolId": "ap-southeast-1_xxxxxxx",
      "AppClientId": "xxxxxxxxxxx",
      "Region": "ap-southeast-1"
    }
  }
}

Environment(please complete the following information):

  • SDK Version: 2.8.2

Device Information (please complete the following information):

  • Device: Samsung Note 4
  • Android Version: 6.0.1
  • Specific to simulators:

If you need help with understanding how to implement something in particular then we suggest that you first look into our developer guide. You can also simplify your process of creating an application, as well as the associated backend setup by using the Amplify CLI.

suandplzop avatar Nov 21 '18 09:11 suandplzop

Hi @scdplzop ,

Thanks for pointing out the issue. We are looking at it and aiming to resolve this in a future release with pull request #593

minbi avatar Dec 05 '18 20:12 minbi

Hi @scdplzop ,

We have released a fix in version 2.8.5 of the SDK. Please see if this fixes the issue for you.

minbi avatar Dec 06 '18 23:12 minbi

Hi @minbi , After migrate to 2.8.5, the exception mentioned above gone, and now without providing client secret in awsconfuguration.json works. Thanks to anyone working on this issue.

suandplzop avatar Dec 07 '18 03:12 suandplzop

Excellent, thanks for confirming.

frankmuellr avatar Dec 07 '18 14:12 frankmuellr