2回答
- 新しい順
- 投票が多い順
- コメントが多い順
0
Wrote a code myself. It works.
https://coding-with-simple.blogspot.com/2023/08/simple-php-code-for-aws-cognito-oauth2.html
回答済み 9ヶ月前
0
Hi,
Recommended way to access AWS services with PHP is via AWS PHP SDK.
Specifically for Cognito: https://docs.aws.amazon.com/aws-sdk-php/v2/guide/service-cognitoidentity.html
Available Cognito APIs: https://docs.aws.amazon.com/aws-sdk-php/v2/guide/service-cognitoidentity.html#api-reference
ListIdentities and DescribeIdentity are the APIs that you need.
Best,
Didier
関連するコンテンツ
- AWS公式更新しました 2年前
Hi Didier,
Thanks for the answer. The reference doesn't explain how to get the client data out. My code segment as follows.
if ($responseBody!=null){ $tokenData = json_decode($responseBody, true); $accessToken = $tokenData['access_token']; $idToken = $tokenData['id_token']; error_log("----2 idToken : ".$idToken); error_log("----2 accessToken : ".$accessToken);
if ($accessToken!=null){ $credentials = [ 'key' => $accessToken, 'secret' => $clientSecret, 'token' => $idToken, // Only needed for temporary session tokens (e.g., with AssumeRole) 'verify' => false, ]; $cognitoClient = new CognitoIdentityProviderClient([ 'version' => 'latest', 'region' => 'eu-west-2', 'credentials' => $credentials, 'verify' => false, ]);
-