- How do I install and configure ellaisys/aws-cognito in a Laravel app?
- Install it with Composer using composer require ellaisys/aws-cognito, then publish the package configuration and set your AWS region, Cognito User Pool ID, app client ID, and guard options. Register the guard and middleware in your Laravel auth configuration, then point your web or API routes at the Cognito guard. Check the README for the exact config keys and environment variables for your version.
- Which Laravel and PHP versions does ellaisys/aws-cognito support?
- The package is on the v2.0.x line, but the provided context does not list exact Laravel and PHP version constraints. Verify the README and composer.json support matrix before adopting, especially if you are on a newer Laravel release. The v2.0.9 release adds no config, migration, or contract changes, so it does not widen or narrow framework compatibility.
- How does ellaisys/aws-cognito integrate with Laravel auth guards?
- It provides a Laravel auth guard that delegates authentication to an AWS Cognito User Pool, so your app can use Laravel's normal auth contracts instead of hand-rolling SDK calls. You configure the guard for web or API flows, and the package supplies middleware and helpers for protected routes. This keeps policy and Gate authorization in your Laravel app while Cognito handles identity.
- Can I use ellaisys/aws-cognito for API authentication and route protection?
- Yes. The package supports API authentication flows, token validation, and middleware for protecting API routes. Configure an API guard backed by Cognito and apply the package middleware to the routes you want to protect. You should still add tests for token expiry, refresh, and misconfiguration because those failure paths are operationally important.
- Does the package support MFA, social login, and OAuth2 with Cognito?
- Yes. It supports OAuth2, social logins, and MFA alongside standard registration, login, password reset, and email verification. These flows are the main reason to use the package rather than writing Cognito SDK calls in controllers. Confirm any advanced Cognito features you need, such as custom auth challenges or device tracking, because the wrapper may not model every flow.
- How are JWT access tokens and custom claims handled by ellaisys/aws-cognito?
- The package manages JWT and access tokens and exposes custom claims for use in your Laravel app. It is designed to handle token validation and refresh as part of the Cognito guard flow. Because token lifecycle is security-critical, add your own integration tests around expired refresh tokens, throttling, and invalid pool configuration.
- What changed in v2.0.9 and is it a breaking upgrade?
- v2.0.9 is a test-and-documentation release. It adds console command coverage, more tests, API route and endpoint testing, architecture and flow diagrams, and documentation corrections. It does not change runtime behavior or require schema, migration, or config changes, so upgrading from an earlier 2.0.x pin is a patch bump with no documented breaking changes.
- Is ellaisys/aws-cognito production ready given its test coverage?
- Treat it as usable but not risk-free: the vendor states test coverage of more than 50%, which is below what many teams accept for credential and token handling. The added tests improve confidence in console commands and routes, but they do not prove coverage of auth-critical failure paths. For production, plan your own integration tests and have a rollback path.
- How can I test Cognito auth flows in Laravel CI without a real user pool?
- Run the package's test suite and add Laravel feature tests that mock Cognito or AWS SDK responses for registration, login, MFA, password reset, and token refresh. A dedicated Cognito test user pool is better for end-to-end confidence but costs more setup. The v2.0.9 API route tests are a useful starting point, not a substitute for testing your own guard configuration.
- Who maintains ellaisys/aws-cognito, and what should I check before choosing it over alternatives?
- It is a community-maintained wrapper, and the provided context does not document a formal support policy or release cadence, so confirm maintainer activity and assign an internal owner. Compare it with a custom Laravel guard built directly on the AWS SDK or other Cognito integration options if you need flows the wrapper does not cover. Evaluate alternatives on maintenance, test depth, and how cleanly they fit Laravel's auth contracts.