{"id":18534664,"url":"https://github.com/pianosnake/verify-cognito-token","last_synced_at":"2025-04-09T15:31:48.537Z","repository":{"id":31897169,"uuid":"130613169","full_name":"pianosnake/verify-cognito-token","owner":"pianosnake","description":null,"archived":true,"fork":false,"pushed_at":"2025-02-02T04:03:11.000Z","size":49,"stargazers_count":7,"open_issues_count":8,"forks_count":11,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-28T19:34:29.320Z","etag":null,"topics":["aws","aws-cognito","cognito","cognito-user-pool"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/pianosnake.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}},"created_at":"2018-04-22T22:31:17.000Z","updated_at":"2025-02-02T04:04:09.000Z","dependencies_parsed_at":"2022-07-29T13:49:13.178Z","dependency_job_id":null,"html_url":"https://github.com/pianosnake/verify-cognito-token","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pianosnake%2Fverify-cognito-token","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pianosnake%2Fverify-cognito-token/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pianosnake%2Fverify-cognito-token/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pianosnake%2Fverify-cognito-token/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pianosnake","download_url":"https://codeload.github.com/pianosnake/verify-cognito-token/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248058018,"owners_count":21040677,"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","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","aws-cognito","cognito","cognito-user-pool"],"created_at":"2024-11-06T19:16:33.813Z","updated_at":"2025-04-09T15:31:48.530Z","avatar_url":"https://github.com/pianosnake.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# This lib has been archived! No longer maintained!\n\n# Verify Cognito Token\n\nVerify either the ID token or the access token provided by AWS Cognito.\n\nThis is a Node friendly refactor of AWS labs' [decode-verify-jwt](https://github.com/awslabs/aws-support-tools/blob/master/Cognito/decode-verify-jwt/decode-verify-jwt.js). The process is explained in the section __Using ID Tokens and Access Tokens in your Web APIs__ from this [AWS Document](https://docs.aws.amazon.com/cognito/latest/developerguide/amazon-cognito-user-pools-using-tokens-with-identity-providers.html).\n\nInstall with `npm install verify-cognito-token -S`\n\n## Usage\n\n```javascript\n// params\nconst params = {\n  region: '\u003cyour-aws-region\u003e',  // required\n  userPoolId: '\u003cyour-user-pool-id\u003e', // required\n  debug: true // optional parameter to show console logs\n}\n\n//optional claims examples\nconst claims = {\n  aud: '\u003cyour-app-client-id\u003e',\n  email_verified: true,\n  auth_time: time =\u003e time \u003c= 1524588564,\n  'cognito:groups': groups =\u003e groups.includes('Admins')\n}\n\nconst Verifier = require('verify-cognito-token');\nconst verifier = new Verifier(params, claims);\n\nverifier.verify(token)\n.then(result =\u003e{\n  //result will be `true` if token is valid, non-expired, and has matching claims\n  //result will be `false` if token is invalid, expired or fails the claims check\n})\n\n```\n\nThe `userPoolId` parameter is available from Cognito/Manage Your User Pools/Your-Pool-Name/General Settings. \n\nThe `claims` parameter is an optional parameter used to match against the token's claims. Its keys are claim names and its values can be any of [string, number, boolean, function]. If the value is any of [string, number, boolean] it is checked for strict equality against the token's claim with a matching name. If it is a function, the function is run against the claim. Do not try to match against an object or an array; rather use a function to test for a particular property.\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpianosnake%2Fverify-cognito-token","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpianosnake%2Fverify-cognito-token","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpianosnake%2Fverify-cognito-token/lists"}