3

Im trying to implement a spring boot back end for cognito, I managed to create one and perform signing in, after the sign in i got to the new password is required to change the default password, so I have submitted my request but got an exception saying:

Invalid attributes given, address is missing.

I have tried to send the address as string, and json object but the same exception occurred.

I have checked the read and write permissions in my cognito pool and they must be writable!

So any suggestions about this issue?

Aws cognito pool address attribute can't be sent neither as an object or string in the request, it always return the following exception:

Invalid attributes given, address is missing (Service: AWSCognitoIdentityProvider; Status Code: 400; Error Code: InvalidParameterException; Request ID: 638dd0e5-2d76-11e9-839d-2b2efb147c0b)

The first try was to send the request without any thing to do with the address, it returned the same exception, then I added it as a string and the same exception again, and then I have tried to send it as an object and the same happened.

any suggestions on how should I send the attribute?

Here is how I'm implementing it:

Map<String, String> challengeResponses = new HashMap<String, String>();
challengeResponses.put(USERNAME, passwordRequest.getUserName());
challengeResponses.put(PASSWORD, passwordRequest.getOldPassword());
challengeResponses.put(NEW_PASSWORD, passwordRequest.getNewPassword());
challengeResponses.put("ADDRESS", "test");
AdminRespondToAuthChallengeRequest changeRequest = new AdminRespondToAuthChallengeRequest()
.withChallengeName(ChallengeNameType.NEW_PASSWORD_REQUIRED).withChallengeResponses(challengeResponses).withClientId(clientID).withUserPoolId(poolID)
                .withSession(sessionString);

System.out.println(changeRequest.toString());
AdminRespondToAuthChallengeResult challengeResponse = mIdentityProvider.adminRespondToAuthChallenge(changeRequest);

Here is the request that I'm sending:

{UserPoolId: eu-central-1_RZxg4jT2t,ClientId: 2cdjo5ljk130db1mltjnmv128p,ChallengeName: NEW_PASSWORD_REQUIRED,ChallengeResponses: {address=test, PASSWORD=test!, NEW_PASSWORD=test, USERNAME=test},Session: 144WvRkekrIojcPQGDBBu3XsadMBauwQcAJ3M3JVMxD-CY0rCizK1g4RnNuaNN4b1EJMUlrvSnyd21pAP3zFkIlEFXse1MlOLWaGUQIaIygTzX33Y2no0cmfK2-h88yjiKN5-MQZaK6tmvszCuATmOQCR_OK1qLIDYlp1kKGPM_EpBT-br-e5DL9SEF8XIY5wLWGHYWxo4BUuJAIZpTJ8PpD3ROa46ac5w79lhHIK1QZj13f4G84eVz4X8nwiHgLEGgbUOOpoDBC85KSQan8lb-vfPsHEvpoStFy7_0zgRmJ910DubJXJaiS2IjutBr5txDDaSnTl9Zt4G-_NP6_8E0c5JnXIXZymR9nSSYNP7seHXC7HLtFX6Tbu8XWJlLCtKVc8gXN6j0XTzB3hfu-0zGFc3tJ1sQ6iQtLFupuD9C8HYWP6KH_9v2PlUrGc01uU_OOQx5lLaHbNrOvb4evlx9fovM0B6FuPLfUgNmc8aKGZ0Rw55t-aExpJJ_AY2E42C_RWXVX5YUFZTaRi8OvskQLLlyVt0uWV8w1HRc0uGJc5drTK4c7U7TDCaD2-tMiA5TwlpsdCAxv-kRKfMpXN2D6rzzB9An6tis3n9olV5W0yK-KKB1ietx5C-l-HewPBVz9_g-1ggBvwh3qVYjKe1UHcpd5c8SM8kjcwjwy_8fGphYHR4sZBa5zftyT7dYktKzpJsH8HzbZ4Q8WZOKcGqtyeCzkqZuO0LanSL-6yKlGWPEA4tGUhjvT-mWyPEMg576UMPAcWiO6fV-yUVBG5V3OSRpR00NasyFpmTy8U29XI7bfXUMmgY3-6h4nPgaObi25jnmyhDcp2N4MQQl45d0PvmvxIx7huPIzbVC5NNq7tPg6V4H_88cIb81p4gJZ_FITeeSgVWIYRFSoY7vR4DLL9qS3Ea_pAxaENA,}
Khaled
  • 529
  • 8
  • 19

1 Answers1

5

It looks like in the settings of your User Pool you have "address" also as a required attribute for the user.

So in that case you must pass that parameter also in the hashmap as :

challengeResponses.put('userAttributes.address', passwordRequest.getAddress())

Or something like that.

Deepthi
  • 495
  • 4
  • 12
  • Actually I have solved this issue by chaining another method called withAttributes(new Attribute().withName("").withValue("")); many thanks though. – Khaled Feb 13 '19 at 14:38