8

We are looking into using user pools for our application. I would like to try out API in REST manner. Documentation at https://docs.aws.amazon.com/cognito-user-identity-pools/latest/APIReference/Welcome.html doesn't have request and response examples like others. Looking for SignUp, ResendConfirmationCode,ChangePassword and ConfirmSignUp examples.

hechoo
  • 101
  • 1
  • 4

2 Answers2

9

Currently it is not in Cognito user pools documentation, but following example should work for SignUp. Similarly you can formulate it for other APIs. Payload should be what has been mentioned in the documentation you pointed

CONTENT-TYPE: application/x-amz-json-1.1
X-AMZ-TARGET: com.amazonaws.cognito.identity.idp.model.AWSCognitoIdentityProviderService.SignUp

HOST: https://cognito-idp.us-east-1.amazonaws.com

{
"ClientId": "string",
"Password": "string",
"SecretHash": "string",
"UserAttributes": [
    {
        "Name": "string",
        "Value": "string"
    }
],
"Username": "string",
"ValidationData": [
    {
        "Name": "string",
        "Value": "string"
    }
]
}

Due to complex SRP calculation logic on client side during authentication, it is recommended to use the SDKs provided along with Cognito user pools. But seems like the APIs you mentioned above should not have this calculation, so it should be possible to make REST calls.

Vinay Kushwaha
  • 1,767
  • 11
  • 12
  • 3
    This is exactly what i am looking for. Thanks Vinay – hechoo Jun 19 '16 at 16:04
  • 2
    @VinayKushwaha Thanks for this answer! It set me on the right track. Only it seems like aws has changed their backend a bit so now the second content header should be: `X-AMZ-TARGET: AWSCognitoIdentityProviderService.SignUp` Otherwise it returns `UnknownOperationException`. Please update your answer. Yet again, thanks a bunch! – Nika Kasradze Jan 15 '17 at 16:08
  • Thanks for pointing it out. I think it was just a typo in operation name. Changing Signup -> SignUp fixed the example. – Vinay Kushwaha Jan 16 '17 at 18:38
1

Maybe you are looking for this?

Actions supported by Amazon Cognito REST APIs

Rakib
  • 12,376
  • 16
  • 77
  • 113
  • 3
    Syed, Thanks for responding. Some of APIs are missing examples that i am looking for. Vinay's answer covers it. – hechoo Jun 19 '16 at 16:07