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

Cognito ConfirmSignUp api doesn't expose the forcedAliasCreation property

Open zerox92 opened this issue 1 year ago • 3 comments

We need to call the confirmSignUp api but there is no public method exposing this property and the value of it is hardcoded to false. Can we expose a method to have the ability to set this to true.

https://github.com/aws-amplify/aws-sdk-android/blob/9134f0b64d2698f69ab6f3db568e6318ce6d43b7/aws-android-sdk-cognitoidentityprovider/src/main/java/com/amazonaws/mobileconnectors/cognitoidentityprovider/CognitoUser.java#L300

zerox92 avatar Oct 13 '23 15:10 zerox92

Thank you for your report. I have recorded as an enhancement that we need to make to our confirmSignUp method.

gpanshu avatar Oct 13 '23 20:10 gpanshu

@zerox92 I'm a bit confused here. The method linked is public and takes in a forcedAliasCreation boolean. There is no default set? Are you referring to Amplify not being able to set forcedAliasCreation?

tylerjroach avatar Nov 15 '23 14:11 tylerjroach

I understand that you may have been trying to get to this method from AWSMobileClient, which does not expose its created userpool. You should be able to directly hit this method using a snippet as shown below.

Note: If your awsconfiguration.json file is not stored in the default location, you would have to customize how AWSConfiguration is instantiated.

// Snippet should be run on a worker thread, otherwise you will get networking on main thread exception
val userpool = CognitoUserPool(this, AWSConfiguration(this))
userpool.getUser("username").confirmSignUp(
    "challengeResponse",
    true,
    clientMetadata,
    object : GenericHandler {
        override fun onSuccess() {
            // handle success
        }

        override fun onFailure(exception: Exception) {
            // handle failure
        }
    }
)

tylerjroach avatar Nov 15 '23 15:11 tylerjroach