{"id":16161238,"url":"https://github.com/kennethwussmann/cognito-cli","last_synced_at":"2025-07-25T13:08:37.794Z","repository":{"id":36302411,"uuid":"172358727","full_name":"KennethWussmann/cognito-cli","owner":"KennethWussmann","description":"Small CLI tool to obtain a JWT from a Cognito userpool","archived":false,"fork":false,"pushed_at":"2023-12-01T07:21:56.000Z","size":1346,"stargazers_count":4,"open_issues_count":7,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-09T03:33:46.250Z","etag":null,"topics":["aws","cli","cognito","cognito-cli","jwt"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/KennethWussmann.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2019-02-24T16:05:08.000Z","updated_at":"2024-06-18T20:44:26.000Z","dependencies_parsed_at":"2024-10-27T19:27:37.881Z","dependency_job_id":null,"html_url":"https://github.com/KennethWussmann/cognito-cli","commit_stats":{"total_commits":53,"total_committers":4,"mean_commits":13.25,"dds":"0.49056603773584906","last_synced_commit":"fb2d7486f321e3bfce8cf19b533442afe2b429a8"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/KennethWussmann/cognito-cli","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KennethWussmann%2Fcognito-cli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KennethWussmann%2Fcognito-cli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KennethWussmann%2Fcognito-cli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KennethWussmann%2Fcognito-cli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/KennethWussmann","download_url":"https://codeload.github.com/KennethWussmann/cognito-cli/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KennethWussmann%2Fcognito-cli/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267010091,"owners_count":24020743,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-25T02:00:09.625Z","response_time":70,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["aws","cli","cognito","cognito-cli","jwt"],"created_at":"2024-10-10T02:24:37.633Z","updated_at":"2025-07-25T13:08:37.747Z","avatar_url":"https://github.com/KennethWussmann.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# :guardsman: cognito-cli\n\nSmall CLI tool to obtain a JWT from a Cognito userpools. Supports multiple userpools ordered by stages and MFA.\n\n## :rocket: Usage\n\n- Install globally `npm install -g cogcli`\n- Run the global command `cognito` or `cogcli`\n- New config will be created at `~/.cognito-cli/config.json`\n- Provide credentials in the config file\n\n## :books: Configuration\n\nThis is the example `~/.cognito-cli/config.json`:\n\n```JSON\n{\n    \"settings\": {\n      \"port\": 8080\n    },\n    \"pools\": [\n        {\n            \"name\": \"Example\",\n            \"dev\": {\n                \"poolId\": \"eu-west-1_1234567\",\n                \"clientId\": \"abc123456\",\n                \"username\": \"user\",\n                \"password\": \"OPTIONAL_PASSWORD\",\n                \"otpSecret\": \"OPTIONAL_OTPSECRET\"\n            }\n        }\n    ]\n}\n```\n\n\u003e The password and otpSecret are optional. You'll be prompted for them if not added to the config.\n\nWith `port` the default port for the local webserver can be globally adjusted.\n\nYou can add as many `pools` with `stages`. Example:\n\n```JSON\n{\n    \"settings\": {\n      \"port\": 8080\n    },\n    \"pools\": [\n        {\n            \"name\": \"Application 1\",\n            \"test123\": {\n                \"poolId\": \"eu-west-1_1234567\",\n                \"clientId\": \"abc123456\",\n                \"username\": \"user\",\n                \"password\": \"OPTIONAL_PASSWORD\",\n                \"otpSecret\": \"OPTIONAL_OTPSECRET\"\n            }\n        },\n        {\n            \"name\": \"Something else\",\n            \"hello\": {\n                \"poolId\": \"eu-west-1_1234567\",\n                \"clientId\": \"abc123456\",\n                \"username\": \"user\",\n                \"password\": \"OPTIONAL_PASSWORD\"\n            }\n        }\n    ]\n}\n```\n\n## :arrows_clockwise: MFA Support\n\nWhen the Cognito user requires MFA login:\n\n- You can supply the OTP secret which can be used to generate a token in the config via `otpSecret`\n- If no `otpSecret` present you will be prompted to enter the token manually\n- You can also use `--token 123456` to supply the token directly\n- When using the local webserver you can use the `?token=123456` query parameter with your request\n\n\u003e :bangbang:️ Notice that this tool is for development purposes only.\n\u003e Never hold confidential credentials together with MFA secrets in a plain-text file.\n\n## :man_technologist: CLI\n\nYou can run the global command `cognito`.\n\n### Running without arguments\n\nWhen you run just `cognito` without args you will be prompted with all possible pools \u0026 stages:\n\n**Shows list of applications configured**\n\n```\n? What pool type would you like to use? (Use arrow keys)\n❯ Application 1\n  Application 2\n```\n\n**Shows available stages for this application**\n\n```\n? What pool type would you like to use? Application 1\n? And for what stage?\n  dev\n❯ int\n  prd\n```\n\n**Copies the obtained JWT to your clipboard (macOS, Linux \u0026 Windows)**\n\n```\nCopied JWT for Application 1 INT to clipboard!\n```\n\n### Running with arguments\n\nThis CLI tool also allows the following arguments:\n\n```\nUsage: cognito [options]\n\nOptions:\n  -V, --version        output the version number\n  -p, --pool [name]    Use the pool by [name]\n  -s, --stage [stage]  Use the [stage]\n  -c, --copy           Copy the token directly to clipboard\n  -S, --server [port]  Start a local webserver that can serve tokens\n  -t, --token [token]  Token for MFA challenge\n  -h, --help           display help for command\n```\n\n## :globe_with_meridians: Local webserver\n\nUsing `cognito -S` will start a local webserver (default on port 8080) that can be used to retrieve a JWT token for pool \u0026 stage.\nThe webserver has the following endpoint:\n\n- `GET /{pool}/{stage}` - Get a fresh JWT token (no caching!)\n- `GET /{pool}/{stage}?token=123456` - Get a fresh JWT token with MFA token if required\n\n### Examples\n\n```\n$ curl -X GET http://localhost:8080/example/dev\n{\n  \"token\": \"eyJra...\"\n}\n```\n\nThat's useful for example in REST clients like Insomnia or Postman to chain requests: Get Token -\u003e Post something.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkennethwussmann%2Fcognito-cli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkennethwussmann%2Fcognito-cli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkennethwussmann%2Fcognito-cli/lists"}