https://github.com/vandium-io/aws-cognito-public-keys
Gets public keys for a given AWS Cognito user pool id
https://github.com/vandium-io/aws-cognito-public-keys
Last synced: 20 days ago
JSON representation
Gets public keys for a given AWS Cognito user pool id
- Host: GitHub
- URL: https://github.com/vandium-io/aws-cognito-public-keys
- Owner: vandium-io
- License: bsd-3-clause
- Created: 2020-01-22T19:58:02.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-01-05T05:31:55.000Z (over 2 years ago)
- Last Synced: 2025-06-17T23:02:11.402Z (28 days ago)
- Language: JavaScript
- Size: 472 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 10
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
[](https://travis-ci.org/vandium-io/aws-cognito-public-keys)
[](https://badge.fury.io/js/aws-cognito-public-keys)# `aws-cognito-public-keys`
Module for retrieving public keys for AWS Cognito user pools
## Features
* Does not require AWS credentials
* Synchronous and asynchronous methods
* Node.js 12.x compatible, works in AWS Lambda environments## Installation
Install via npm.npm install aws-cognito-public-keys --save
## Getting Started
```js
const { getKeysSync } = require( 'aws-cognito-public-keys' );const userPoolId = 'us-east-1_ZLPZ8Z7yS'; // your user pool id
const awsRegion = 'us-east1'; // valid AWS Region
const key = getKeysSync( userPoolId, awsRegion );
// keys =
// {
// "": { ...key1 ... }
// "": { ...key2 ... }
// ..
// }
```## API
### `async getKeys( userPoolId, region )`
Gets the Cognito public keys asynchronously. Returns a promise that resolves to
an object that contains the keys.### `getKeysSync( userPoolId, region )`
Gets the Cognito public keys synchronously and blocks until resolved. Returns an
object that contains the keys.## Feedback
We'd love to get feedback on how to make this tool better. Feel free to contact
us at `[email protected]`## License
[BSD-3-Clause](https://en.wikipedia.org/wiki/BSD_licenses)