我必须使用Cognito API(不使用带有SDK的语言编码)。我正在使用Fiddler来测试最近创建的用户池和用户注册,但我不断得到:
HTTP / 1.1 400错误请求x-amzn-ErrorType:UnknownOperationException。
有人能指出我正确的方向吗?
我觉得我的网址可能有误并且/或者用户池ID需要包含在某处。
POST https://cognito-idp.us-west-2.amazonaws.com/ HTTP/1.1
CONTENT-TYPE: application/x-amz-json-1.1
X-AMZ-TARGET: com.amazonaws.cognito.identity.idp.model.AWSCognitoIdentityProviderService.Signup
HOST: cognito-idp.us-west-2.amazonaws.com
{
"ClientId": "##################", //App client id. The app associated with the User Pool
"Password": "98765432", //min length 8, requires numbers...JUST FOR TESTING
"UserAttributes": [ //email and name are the only attributes for this pool...JUST FOR TESTING
{
"email": "###########", //an email address
"name": "Joe" //user's name
}
],
"Username": "testName987" //the user name
}
看来有些人已经完成了这个基本步骤,如here和here所示,但我在第一步中苦苦挣扎。
TIA
答案 0 :(得分:1)
以下是我的成功要求:
POST / HTTP/1.1
Host: cognito-idp.us-east-1.amazonaws.com
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
X-Amz-User-Agent: aws-sdk-js/2.6.4
Content-Type: application/x-amz-json-1.1
X-Amz-Target: AWSCognitoIdentityProviderService.SignUp
X-Amz-Content-Sha256: b2c2b342a0b689bf895aa960ebcf183b633f7ece15725c1807de9ecba005f51d
Content-Length: 244
origin: null
Connection: keep-alive
请注意,请求是POST和X-Amz-Target:AWSCognitoIdentityProviderService.SignUp。请求的参数作为JSON传递。