arc-macro-jwt
Use JWT authentication with Architect HTTP APIs (APIG HTTP Api only).
Install:
npm i arc-macro-jwt
Add to your .arc-file:
@appmyapp @awsapigateway http @jwtissuer https://example.auth0.com/ #Issuer of JWTaudience https://example.com,https://example2.com #Audience in the JWTidentitySource $request.header.Authorization #Where is the token sourcescopes read:foo,write:foo #Not requireddefault false #Set to true to secure all routes (@jwt pragmas in .arc-config are ignored) @httpget /get /fooget /bar @macrosarc-macro-jwt
And add to individual .arc-config files for routes that needs auth:
@jwtscopes read:bar,write:bar #Not required (use default scopes or none when not specified)
See AWS::Serverless::HttpApi/HttpApiAuth for more information.