/lambda-authorizer-utils

Collection of utilities and helper functions to make working with Lambda Authorizers easy

Primary LanguageTypeScriptMIT LicenseMIT

Lambda Authorizer Utils

Collection of utility functions / helpers to help with building Api Gateway Lambda Authorizer easier with Typescript

Install

yarn add @distinction-dev/lambda-authorizer-utils

Modules

Usage

import { AuthorizerResponse } from "@distinction-dev/lambda-authorizer-utils";

export const authorizer = (event: APIGatewayRequestAuthorizerEvent) => {
  const response = new AuthorizerResponse(
    "<principal_id>",
    "<aws_region>",
    "<aws_account_id>",
    "<api_id>",
    "<api_stage>"
  );
  response.addRoute("GET", "/test");
  return response.getPolicy();
};

Docs

Full docs here