PHP code example of efadah / laravel-cognito-auth

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

    

efadah / laravel-cognito-auth example snippets


// config/app.php
'providers' => [
    ...
    efadah\LaravelCognitoAuth\CognitoAuthServiceProvider::class,

];
bash
php artisan vendor:publish --provider="efadah\LaravelCognitoAuth\CognitoAuthServiceProvider"

         public function verifyEmail(
                $token,
                CognitoClient $cognitoClient,
                CognitoUserPropertyAccessor $cognitoUserPropertyAccessor
            ) {
                $user = User::whereToken($token)->firstOrFail();

                $user->token = null;
                $user->save();

                $cognitoClient->setUserAttributes($user->email, [
                    'email_verified' => 'true',
                ]);

                if ($cognitoUserPropertyAccessor->getUserStatus($user->email) != 'CONFIRMED') {
                    $cognitoClient->confirmSignUp($user->email);
                    return response()->redirectToRoute('login');
                }

                return response()->redirectToRoute('dashboard');
            }
        

    public function deleteUser(Request $request, CognitoClient $cognitoClient)