PHP code example of graphene-ict / laravel-cognito-guard

1. Go to this page and download the library: Download graphene-ict/laravel-cognito-guard 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/ */

    

graphene-ict / laravel-cognito-guard example snippets


return [
    /*
     * If persist_user_data is true the cognito guard will automatically create a new user
     * record anytime the user contained in a validated JWT
     * does not already exist in the users table.
     *
     * The new user will be created with the user attributes name, email, provider and provider_id so
     * it is  model but you may use whatever you like.
         *
         */
        'user' => [
            'model' => App\Models\User::class,
        ],
    ],
];

   $cognitoService = new CognitoService();
   $attributes = $cognitoService->getCognitoUserAttributes($token);

   'api' => [
            'driver' => 'cognito',
            'provider' => 'users',
        ],

    'defaults' => [
        'guard' => 'api',
        'passwords' => 'users',
    ],
bash
php artisan vendor:publish --provider="GrapheneICT\CognitoGuard\Services\CognitoAuthServiceProvider" --tag="config"