1. Go to this page and download the library: Download customergauge/cognito 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/ */
/*
|--------------------------------------------------------------------------
| Cognito Custom Configuration
|--------------------------------------------------------------------------
|
| The following configuration is not part of standard Laravel application.
| We use it to configure the CognitoUserProvider process so that we can
| properly validate the JWT token provided by AWS Cognito.
|
*/
'cognito' => [
'pool' => env('AWS_COGNITO_USER_POOL_ID'),
'region' => env('AWS_COGNITO_USER_POOL_REGION'),
],
final class CognitoUserFactory implements UserFactory
{
public function make(array $payload): ?Authenticatable
{
return new MyUserObject(
$payload['username'],
$payload['custom:my_custom_cognito_attribute'],
);
}
}