{"id":21197272,"url":"https://github.com/riolaf05/aws-cognito-fastapi-auth","last_synced_at":"2026-05-03T23:32:18.748Z","repository":{"id":238987493,"uuid":"797904756","full_name":"riolaf05/aws-cognito-fastapi-auth","owner":"riolaf05","description":"Code to validate JWT tokens from Cognito on FastAPI","archived":false,"fork":false,"pushed_at":"2024-05-09T09:21:31.000Z","size":12,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-27T06:46:54.142Z","etag":null,"topics":["authentication","aws","cognito","cognito-user-pool","fastapi","oauth2","terraform"],"latest_commit_sha":null,"homepage":"","language":"HCL","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/riolaf05.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-05-08T17:57:54.000Z","updated_at":"2024-05-09T09:21:34.000Z","dependencies_parsed_at":"2024-05-09T10:40:00.668Z","dependency_job_id":null,"html_url":"https://github.com/riolaf05/aws-cognito-fastapi-auth","commit_stats":null,"previous_names":["riolaf05/aws-cognito-fastapi-auth"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/riolaf05/aws-cognito-fastapi-auth","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/riolaf05%2Faws-cognito-fastapi-auth","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/riolaf05%2Faws-cognito-fastapi-auth/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/riolaf05%2Faws-cognito-fastapi-auth/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/riolaf05%2Faws-cognito-fastapi-auth/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/riolaf05","download_url":"https://codeload.github.com/riolaf05/aws-cognito-fastapi-auth/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/riolaf05%2Faws-cognito-fastapi-auth/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32589108,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-03T22:12:39.696Z","status":"ssl_error","status_checked_at":"2026-05-03T22:09:10.534Z","response_time":103,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["authentication","aws","cognito","cognito-user-pool","fastapi","oauth2","terraform"],"created_at":"2024-11-20T19:43:16.976Z","updated_at":"2026-05-03T23:32:18.734Z","avatar_url":"https://github.com/riolaf05.png","language":"HCL","funding_links":[],"categories":[],"sub_categories":[],"readme":"# FastAPI Project with Cognito Authentication\nThis repository contains a FastAPI project with Cognito-based authentication. Below are the steps to install, configure, and use the application.\n\n## Prerequisites\nMake sure you have Terraform installed on your system and configured correctly for managing infrastructure.\n\n1. Installing Infrastructure\nNavigate to the infrastructure folder.\nRun `terraform init` and `terraform apply` to create the necessary infrastructure.\n\n2. Configuring Environment Variables\nCopy the Cognito ID and Cognito Secret from the AWS console.\nAdd these values to your environment variables file as COGNITO_ID and COGNITO_SECRET.\n\n3. Launching the FastAPI Application\nEnsure you have all Python dependencies installed (`pip install -r requirements.txt`).\nRun the following command to start the FastAPI application:\n\n```console\nuvicorn app.service:app --host 0.0.0.0 --port 3000 --reload\n```\n\n4. Requesting Access Token\nExecute the following curl command to obtain the access token:\n\n```console\ncurl --request POST \\\n  --url https://fastapi-auth-pool.auth.eu-south-1.amazoncognito.com/oauth2/token \\\n  --header 'content-type: application/x-www-form-urlencoded' \\\n  --data grant_type=client_credentials \\\n  --data scope=fastapi-auth/api\\\n  --data client_id=YOUR_CLIENT_ID \\\n  --data client_secret=YOUR_CLIENT_SECRET\n```\n\nMake sure to replace YOUR_CLIENT_ID and YOUR_CLIENT_SECRET with the correct values.\n\n5. Invoking the Secure Endpoint\nTo call the /secure endpoint, use the token obtained in the previous step as part of the authorization header:\n\n```console\ncurl --request GET \\\n  --url http://localhost:3000/secure \\\n  --header 'Authorization: Bearer YOUR_ACCESS_TOKEN'\n```\n\nMake sure to replace YOUR_ACCESS_TOKEN with the token obtained from the previous step.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Friolaf05%2Faws-cognito-fastapi-auth","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Friolaf05%2Faws-cognito-fastapi-auth","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Friolaf05%2Faws-cognito-fastapi-auth/lists"}