AWS - Cognito - AdminSetUserPassword returns "Operation not found: AdminSetUserPassword"
AWS - Cognito - AdminSetUserPassword returns "Operation not found: AdminSetUserPassword"
我正在尝试为我已经使用 AdminSetUserPassword 函数创建的 Cognito 用户设置密码,但我一直收到 "Operation not found: 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;
}
AdminSetUserPassword
仅添加到版本 3.93.3 的 aws/aws-sdk-php
包中。您可以使用 composer require aws/aws-sdk-php:">3.93.3"
.
更新您的软件包版本
我正在尝试为我已经使用 AdminSetUserPassword 函数创建的 Cognito 用户设置密码,但我一直收到 "Operation not found: 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;
}
AdminSetUserPassword
仅添加到版本 3.93.3 的 aws/aws-sdk-php
包中。您可以使用 composer require aws/aws-sdk-php:">3.93.3"
.