用户池客户端 {id} 不存在
User pool client {id}does not exist
这是我的代码:
use Aws\CognitoIdentityProvider\CognitoIdentityProviderClient;
$args = [
'credentials' => [
'key' => 'valid',
'secret' => 'valid',
],
'region' => 'us-west-2',
'version' => 'latest',
'app_client_id' => 'valid',
'app_client_secret' => 'valid',
'user_pool_id' => 'valid',
];
$email = 'test32@test.com';
$client = new CognitoIdentityProviderClient($args);
$hash_key = cognitoSecretHash($email);
$login = $client->adminInitiateAuth([
'AuthFlow' => 'ADMIN_NO_SRP_AUTH',
'AuthParameters' => [
'Username' => $email,
'Password' => '12345678',
'SecretHash' => $hash_key,
],
'ClientId' => 'valid',
'UserPoolId' => 'valid',
]);
return $login;
function cognitoSecretHash($username)
{
$message = $username . 'app_client_id';
$hash = hash_hmac(
'sha256',
$message,
'app_client_secret',
true
);
return base64_encode($hash);
}
它给我这个错误:
致命错误:未捕获异常 'Aws\CognitoIdentityProvider\Exception\CognitoIdentityProviderException' 消息 'Error executing "AdminInitiateAuth" on "https://cognito-idp.us-west-2.amazonaws.com"; AWS HTTP error: Client error: POST https://cognito-idp.us-west-2.amazonaws.com
resulted in a 400 Bad Request
response: {"__type":"ResourceNotFoundException","message":"User pool client {id} does not exist."} ResourceNotFoundException (client): User pool client {id} does not exist. - {"__type":"ResourceNotFoundException","message":"User pool client {id} does not exist."}' GuzzleHttp\Exception\ClientException:客户端错误:POST https://cognito-idp.us-west-2.amazonaws.com
导致 400 Bad Request
响应:{"__type":"ResourceNotFoundException","message":"用户池客户端 {id} 不存在。"} 在 D:\xampp\htdocs\test\vendor\guzzlehttp\guzzle\src\Exception\RequestException.php:113 堆栈跟踪:#0 D:\xampp\htdocs\test\vend 在 D:\xampp\htdocs\test\vendor\aws\aws-sdk-php\src\WrappedHttpHandler.php 195 行
$login = $client->adminInitiateAuth([
'AuthFlow' => 'ADMIN_NO_SRP_AUTH',
'AuthParameters' => [
'USERNAME' => $email,
'PASSWORD' => $password,
'SECRET_HASH' => $hash_key,
],
'ClientId' => $clientId,
'UserPoolId' => $poolId,
]);
我遇到了这个问题,只需要做一个 amplify pull
- 问题是不同计算机上的项目不同步,git pull
没有涵盖我认为的 aws 后端内容。
这是我的代码:
use Aws\CognitoIdentityProvider\CognitoIdentityProviderClient;
$args = [
'credentials' => [
'key' => 'valid',
'secret' => 'valid',
],
'region' => 'us-west-2',
'version' => 'latest',
'app_client_id' => 'valid',
'app_client_secret' => 'valid',
'user_pool_id' => 'valid',
];
$email = 'test32@test.com';
$client = new CognitoIdentityProviderClient($args);
$hash_key = cognitoSecretHash($email);
$login = $client->adminInitiateAuth([
'AuthFlow' => 'ADMIN_NO_SRP_AUTH',
'AuthParameters' => [
'Username' => $email,
'Password' => '12345678',
'SecretHash' => $hash_key,
],
'ClientId' => 'valid',
'UserPoolId' => 'valid',
]);
return $login;
function cognitoSecretHash($username)
{
$message = $username . 'app_client_id';
$hash = hash_hmac(
'sha256',
$message,
'app_client_secret',
true
);
return base64_encode($hash);
}
它给我这个错误:
致命错误:未捕获异常 'Aws\CognitoIdentityProvider\Exception\CognitoIdentityProviderException' 消息 'Error executing "AdminInitiateAuth" on "https://cognito-idp.us-west-2.amazonaws.com"; AWS HTTP error: Client error: POST https://cognito-idp.us-west-2.amazonaws.com
resulted in a 400 Bad Request
response: {"__type":"ResourceNotFoundException","message":"User pool client {id} does not exist."} ResourceNotFoundException (client): User pool client {id} does not exist. - {"__type":"ResourceNotFoundException","message":"User pool client {id} does not exist."}' GuzzleHttp\Exception\ClientException:客户端错误:POST https://cognito-idp.us-west-2.amazonaws.com
导致 400 Bad Request
响应:{"__type":"ResourceNotFoundException","message":"用户池客户端 {id} 不存在。"} 在 D:\xampp\htdocs\test\vendor\guzzlehttp\guzzle\src\Exception\RequestException.php:113 堆栈跟踪:#0 D:\xampp\htdocs\test\vend 在 D:\xampp\htdocs\test\vendor\aws\aws-sdk-php\src\WrappedHttpHandler.php 195 行
$login = $client->adminInitiateAuth([
'AuthFlow' => 'ADMIN_NO_SRP_AUTH',
'AuthParameters' => [
'USERNAME' => $email,
'PASSWORD' => $password,
'SECRET_HASH' => $hash_key,
],
'ClientId' => $clientId,
'UserPoolId' => $poolId,
]);
我遇到了这个问题,只需要做一个 amplify pull
- 问题是不同计算机上的项目不同步,git pull
没有涵盖我认为的 aws 后端内容。