--- id: flask-cognito version: "1.21" license: MIT license_treatment: permissive maintenance: dormant --- # Flask-Cognito — Authenticate users to Cognito user pool via JWT. License: permissive · Maintenance: dormant · Downloads: 240.3K/mo ## What it is and what it does Flask-Cognito is a Flask extension that plugs AWS Cognito JWT authentication into your application. It validates incoming JWT tokens from Cognito user pools, extracts user identity from the token payload, and provides decorators to protect routes and enforce group-based access control. The extension sits between your Flask routes and Cognito's identity service, handling token verification and making the authenticated user's claims available to your handlers via context variables. You configure it with your Cognito region and user pool ID, then decorate routes with @cognito_auth_required to enforce authentication. The package also supports restricting access by Cognito group membership and lets you hook in a custom identity lookup function to map Cognito users to your own database records. It uses cognitojwt internally to handle JWT validation. Use it for: - Protect Flask API endpoints by requiring valid Cognito access or ID tokens in the Authorization header. - Map Cognito user identities to your application's user database for role-based or permission-based access control. - Enforce group membership restrictions on specific routes using the @cognito_group_permissions decorator. - Authenticate serverless Flask applications deployed on AWS Lambda that rely on Cognito for identity management. - Validate JWT tokens without implementing JWT parsing and cryptographic verification yourself. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Flask-Cognito integrates AWS Cognito JWT authentication into Flask applications, allowing you to protect routes by validating tokens and mapping Cognito identities to your application's user model. Yes, if you are already committed to AWS Cognito and need straightforward JWT validation in Flask. The package is simple, permissive-licensed, and has no external runtime dependencies. However, maintenance is dormant (latest release 2024-04-13), so verify compatibility with your Flask version and check whether cognitojwt and Cognito's API have evolved. Not recommended if you need active support or are evaluating fresh authentication solutions. ## Install pip install flask-cognito uv add flask-cognito poetry add flask-cognito ## Installing Flask-Cognito Before you install: Installation friction is high. Maintenance is dormant—the last commit was 2024-05-05 and the latest release was 2024-04-13. The repository remains active (95 stars, not archived) but updates are infrequent. License in practice: Licensed under MIT (permissive), so you may use, modify, and distribute the package freely in commercial and private projects with minimal restrictions. Quickstart: pip install Flask-Cognito from flask_cognito import CognitoAuth, cognito_auth_required app.config.update({ 'COGNITO_REGION': 'eu-central-1', 'COGNITO_USERPOOL_ID': 'your-pool-id' }) cogauth = CognitoAuth(app) @app.route('/api/private') @cognito_auth_required def protected(): return {'status': 'authenticated'} Requires an AWS Cognito user pool already set up with region and pool ID; Flask and its dependencies must be installed separately. Verify before relying: - Whether the package works with current versions of Flask and its ecosystem (no Python version constraint specified). - Whether cognitojwt dependency is automatically installed or must be added manually. - Current compatibility with modern AWS Cognito API changes since the last release in April 2024. - How long the package has been dormant and whether it remains compatible with current Flask versions. ## Package facts - License: MIT (permissive) - Python support: unspecified - Install friction: high - Maintenance: dormant - Downloads: 240.3K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags flask cognito jwt authentication, aws cognito flask integration, cognito user pool jwt validation, flask jwt auth decorator, cognito group-based access control, serverless flask authentication, cognito token verification flask, aws-cognito, jwt-auth, flask-extension [View on SkillFed](https://skillfed.io/packages/flask-cognito) · [View on PyPI](https://pypi.org/project/flask-cognito/)