CognitoのAPIを直接叩く@ユーザプール編
認証(USER_PASSWORD_AUTH)を許容する必要あり
POST https://cognito-idp.ap-northeast-1.amazonaws.com/ HTTP/1.1
content-type: application/x-amz-json-1.1
x-amz-target: AWSCognitoIdentityProviderService.InitiateAuth
{
"AuthFlow": "USER_PASSWORD_AUTH",
"ClientId": "ClientId",
"AuthParameters": {
"USERNAME": "username",
"PASSWORD": "password"
}
}
属性設定・更新
POST https://cognito-idp.ap-northeast-1.amazonaws.com/ HTTP/1.1
content-type: application/x-amz-json-1.1
x-amz-target: AWSCognitoIdentityProviderService.UpdateUserAttributes
{
"AccessToken": "access_token_str",
"UserAttributes": [
{
"Name": "address",
"Value": "address_value"
}
]
}
ユーザ削除
POST https://cognito-idp.ap-northeast-1.amazonaws.com/ HTTP/1.1
content-type: application/x-amz-json-1.1
x-amz-target: AWSCognitoIdentityProviderService.DeleteUser
{
"AccessToken": "access_token_str"
}