yomafleet / cognito-authenticator
Authentication with AWS Cognito for Laravel project
Package info
github.com/yomafleet/laravel-cognito-authenticator
pkg:composer/yomafleet/cognito-authenticator
v2.0.0
2026-11-27 04:19 UTC
Requires
- php: ^8.2
- aws/aws-sdk-php: ^3.261
- codercat/jwk-to-pem: ^1.1
- firebase/php-jwt: ^6.3|^7.0
- guzzlehttp/guzzle: ^7.5
- illuminate/support: ^12.0|^13.0
Requires (Dev)
- mockery/mockery: ^1.6
- orchestra/testbench: ^10.0|^11.0
- phpunit/phpunit: ^10.5|^11.5|^12.5
Suggests
None
Provides
None
Conflicts
None
Replaces
None
This package is not auto-updated.
Last update: 2026-11-27 04:21:00 UTC
README
Authentication with AWS Cognito for Laravel projects.
Requirements
- PHP 8.2 or higher
- Laravel 12.x
- AWS Cognito User Pool
Installation
Install with composer:
composer require yomafleet/cognito-authenticator
The service provider will be automatically registered.
Configuration
1. Update Auth Guard
Set the 'driver' option of the 'guards' in config/auth.php to 'cognito':
'guards' => [ 'api' => [ 'driver' => 'cognito', 'provider' => 'users', 'hash' => false, ], ],
2. Environment Variables
Add the following to your .env file:
AWS_COGNITO_USER_POOL_ID=your-user-pool-id AWS_COGNITO_REGION=ap-southeast-1 AWS_COGNITO_CLIENT_ID=your-client-id AWS_COGNITO_CLIENT_SECRET=your-client-secret AWS_ACCESS_KEY_ID=your-access-key AWS_SECRET_ACCESS_KEY=your-secret-key
3. Database Migration
Note: This package will add 2 new columns to your users table:
sub(string) - Cognito user identifieridentities(json) - User identity information
Features
- AWS Cognito Integration: Seamless authentication with AWS Cognito User Pools
- JWT Token Validation: Automatic JWT token verification and validation
- User Provider: Custom user provider for Cognito-authenticated users
- Laravel 12 Optimized: Built specifically for Laravel 12
Testing
Run the test suite:
./vendor/bin/phpunit
License
The MIT License (MIT). Please see License File for more information.