PHP code example of black-bits / laravel-cognito-auth

1. Go to this page and download the library: Download black-bits/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/ */

    

black-bits / laravel-cognito-auth example snippets


// config/app.php
'providers' => [
    ...
    BlackBits\LaravelCognitoAuth\CognitoAuthServiceProvider::class,
    
];
bash
php artisan vendor:publish --provider="BlackBits\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)