Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Mirdrack's avatar

Amazon Cognito

Hello: I would like to know if somebody has experience working or integrating Amazon Cognito Service with Laravel in order to authenticate users with Cognito Pools I couldn't find any package related with that so It would be great read all the experiences from everyone because I will try to develop something to implement that service.

Thanks in advance

0 likes
7 replies
Oi_kholman's avatar

I too am interested in any info that people are wiling to share.

privatebox's avatar

Me too.

Has anyone got cognito working via normal php first?

gwilliamtam's avatar

If I try to install pallant/laravel-aws-cognito-auth in Laravel 5.6 I get the next errors... any suggestion?:

- Conclusion: remove symfony/http-foundation v4.0.4
- Conclusion: don't install symfony/http-foundation v4.0.4
- pallant/laravel-aws-cognito-auth v1.1.2 requires symfony/http-foundation ~3.2
Mirdrack's avatar

@gwilliamtam maybe you can fork the package update the minimum requirement and run the test to check if everything is working

1 like
gwilliamtam's avatar

Is a clean copy of Laravel 5.6. Works fine in Laravel 5.5 but doesn't not like Laravel 5.6 requesting symfony/http-foundation 4.0.

I added an issue to the repository.

gwilliamtam's avatar

I used https://github.com/Pod-Point/laravel-cognito-auth instead and after some tuning could make it work. I had to copy their login() into my LoginController to catch some exceptions:

    public function login(Request $request)
    {
        $this->validateLogin($request);

        if ($this->hasTooManyLoginAttempts($request)) {
            $this->fireLockoutEvent($request);

            return $this->sendLockoutResponse($request);
        }

        try{
            if ($this->attemptLogin($request)) {
                return $this->sendLoginResponse($request);
            }
        } catch (CognitoIdentityProviderException $e){
            // do something here
            return redirect()->route('login')->with(['message'=>$e->getMessage()]);
        } catch (\Exception $f){
            // or do something else here
            return redirect()->route('login')->with(['message'=>$e->getMessage()]);
        }

        return $this->sendFailedLoginResponse($request);
    }

Please or to participate in this conversation.