AWS-Cognito-AdminSetUserPassword返回“找不到操作:AdminSetUserPassword”

时间:2019-08-14 14:15:32

标签: php amazon-web-services aws-sdk amazon-cognito

我正在尝试为已使用AdminSetUserPassword函数创建的Cognito用户设置密码,但是我一直收到“未找到操作:AdminSetUserPassword”作为响应。

我检查了CognitoIdentityProvider的版本(“ 2016-04-18”),这似乎不是问题所在。我也尝试使用AdminInitiateAuth和AdminRespondToAuthChallenge解决它,但是InitiateAuth函数的问题是我没有响应“ Session”! 任何帮助将不胜感激!

                    $args = [
                        'credentials' => *CREDENTIALS*,
                        'region' => 'eu-central-1',
                        'version' => 'latest',
                        'app_client_id' => *CLIENT_ID*,
                        'user_pool_id' => *USER_POOL_ID*,
                      ];

                      $client = new CognitoIdentityProviderClient($args);

                      try {

                        $response = $client->adminSetUserPassword([
                          "Password" => $new_password,
                          "Permanent" => true,
                          "Username" => *USER_USERNAME*,
                          "UserPoolId" => *USER_POOL_ID*
                        ]);
                        return true;

                      } catch (Exception $e) {
                        return false;
                      } 

1 个答案:

答案 0 :(得分:0)

AdminSetUserPassword仅添加到版本3.93.3aws/aws-sdk-php软件包中。您可以使用composer require aws/aws-sdk-php:">3.93.3"更新软件包的版本。