https://github.com/adamfitzpatrick/cognito-validator
Decodes and verifies AWS Cognito Identity Pool access tokens.
https://github.com/adamfitzpatrick/cognito-validator
Last synced: 8 months ago
JSON representation
Decodes and verifies AWS Cognito Identity Pool access tokens.
- Host: GitHub
- URL: https://github.com/adamfitzpatrick/cognito-validator
- Owner: adamfitzpatrick
- Created: 2018-06-05T05:23:10.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2018-06-05T05:23:46.000Z (about 8 years ago)
- Last Synced: 2025-10-13T20:03:26.794Z (8 months ago)
- Language: JavaScript
- Size: 33.2 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# cognito-validator
Decodes and verifies AWS Cognito Identity Pool access tokens. Decoding and verification is handled
by [`jsonwebtoken`](https://www.npmjs.com/package/jsonwebtoken), conversion from
[JSON Web Key](https://tools.ietf.org/html/rfc7517) by
[`jwk-to-pem`](https://www.npmjs.com/package/jwk-to-pem) and http requests by
[`request`](https://www.npmjs.com/package/request).
Using the system requires a valid user pool ID, associated client Id and matching AWS region:
```javascript
const CognitoValidator = require('cognito-validator')
const region = 'us-west-2'
const userPoolId = 'USER_POOL_ID'
const clientId = 'CLIENT_ID'
const validator = new CognitoValidator(region, userPoolId, clientId)
const token = /* Some valid JWT issued by AWS Cognito */
const verifiedToken = validator.validate(token)
```