PHP code example of hobbii / cognito-client

1. Go to this page and download the library: Download hobbii/cognito-client library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

hobbii / cognito-client example snippets


use Hobbii\CognitoClient\CognitoClient

$client = CognitoClient::init(
    'EXAMPLEAKIAIOSFODNN7', // AWS Access Key ID
    'EXAMPLEKEYemi/K7MDENG/bPxRfiCYwJalrXUtnF', // AWS Access Key Secret
    'us-west-1', // AWS Region
    '12a34bcde5fgh7ij8kl90mn12o', // Cognito App Client ID
    '12abc3defghi56789jklmnopqrstu012vwxyzabcd34efg56hi7', // Cognito App Client Secret
    'us-west-1_aB12CD34e', // Cognito User Pool ID
);

$authSession = $client->authenticate($username, $password);

$authSession->getAccessToken();
$authSession->getIdToken();
shell
php vendor/bin/phpunit