Skip to content

distinction-dev/lambda-authorizer-utils

Repository files navigation

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