AWS Cognito – SerializationException (Start of structure or map found where not expected)

Question:

I have created a user in Cognito user pool, using the create user option as shown in the image, and want that user to set a new password on first Log In. For this I am using below given method, as given in the AWS documents
Create User from AWS

cognitouser.completeNewPasswordChallenge()

Below is my code

After executing this I get an error saying,

{code: “SerializationException”, name: “SerializationException”,
message: “Start of structure or map found where not expected.”}

These are the attributes which I have selected in User Pool

List Of Attributes and permissions in user pool

Please help me to solve this.

Answer:

In my case it ended up being malformed data being sent to my resetPassword helper. The function was looking for three parameters (username, code, password):

… and I was sending them as an object:

I just updated the helper and I was all set!

Just log your data in the setNewPasswordForAdmin function and I’ll bet you’ll find something awry there.

Leave a Reply