import { APIGatewayTokenAuthorizerEvent } from 'aws-lambda/trigger/api-gateway-authorizer' ; import { Dictionary } from '../../domain/declarations' ; import policyGenerator from './policyGenerator' ; see https see https export default ( event , _context , callback ) : void => { console . log ( 'INSIDE THE AUTHORIZER V1' ) ; console . log ( 'event' , event ) ; if ( ! event . authorizationToken ) { return callback ( null , policyGenerator ( 'user' , 'Deny' , event . methodArn ) ) ; } const tokenParts = event . authorizationToken . split ( ' ' ) ; const tokenValue = tokenParts [ 1 ] ; if ( ! ( tokenParts [ 0 ] . toLowerCase ( ) === 'bearer' && tokenValue ) ) { return callback ( null , policyGenerator ( 'user' , 'Deny' , event . methodArn ) ) ; } const sub = 100 ; const customContext = { userId : sub . toString ( ) , } ; return callback ( null , policyGenerator ( sub . toString ( ) , 'Allow' , event . methodArn , customContext ) ) ; } ;