@bolomio/cognito-authorizer
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

[bolomio] Cognito Authorizer

GitHub Repo npm version

The @bolomio/cognito-authorizer package is an open-source lightweight npm package that provides functions for authenticating with cognito using different authentication flows. It allows you to easily authenticate cognito instances in your Node.js applications.

Features

  • Authenticate with cognito using the client credential flow

Installation

You can install the package using npm:

npm install @bolomio/cognito-authorizer

Usage

const { makeCognitoAuthorizer } = require('@bolomio/cognito-authorizer');
const { HTTPError } = require('got');

// Create an instance of the cognito authorizer with custom options
const authorizer = makeCognitoAuthorizer({
  baseUrl: "https://{domain-name}.auth.{region}.amazoncognito.com/",
});

async function authenticate() {
  try {
    const resource = await authorizer.authenticateWithClientCredentials({
      clientId: 'YOUR_CLIENT_ID',
      clientSecret: 'YOUR_CLIENT_SECRET',
    });
    console.log(resource);
  } catch (e) {
    if (e instanceof HTTPError) {
      console.log(e.response.body);
    }
  }
}

authenticate();

Contributing

Contributions are welcome! If you encounter any issues or have suggestions for improvements, please feel free to open an issue or submit a pull request. Make sure to follow the contribution guidelines.

License

This project is licensed under the GNU General Public License.

Readme

Keywords

none

Package Sidebar

Install

npm i @bolomio/cognito-authorizer

Weekly Downloads

13

Version

1.0.0

License

ISC

Unpacked Size

46.4 kB

Total Files

12

Last publish

Collaborators

  • romulogmp
  • marcusyami