Authorizer

The authorizer section configures the authorization mechanism. ServerlessAPIGateway currently supports JWT (JSON Web Token) based authorization with HS256 algorithm.

Serverless API Gateway now support Auth0. Check its integration page.

  • type: Type of authorization (e.g., JWT).

  • secret: Secret key for authorization.

  • algorithm: Algorithm used for token validation.

  • audience: Intended audience of the token.

  • issuer: The issuer of the token.

Example

{
    "authorizer": {
        "type": "jwt",
        "secret": "{YOUR_SECRET_KEY}",
        "algorithm": "HS256",
        "audience": "opensourcecommunity",
        "issuer": "serverlessapigw"
    },
}

JWT Error

Serverless API Gateway uses JOSE JWT and error states implemented with its error types. Example response:

Error Codes and Responses

JOSEAlgNotAllowed

An error returns when a JOSE Algorithm is not allowed per developer preference.

Response

JWEDecryptionFailed

An error returns when a JWE ciphertext decryption fails.

Response

JWEInvalid

An error returns when the JWE format is invalid.

Response

JWTExpired

An error returns when a JWT has expired.

Response

JWTClaimValidationFailed

An error returns when validation of a JWT claim fails.

Response

JWTInvalid

An error returns when the JWT is invalid.

Response

JWKSNoMatchingKey

An error returns when no matching key is found in the JWKS.

Response

JWKSInvalid

An error returns when the JWKS is invalid.

Response

JWKSMultipleMatchingKeys

An error returns when multiple matching keys are found in the JWKS.

Response

JWSInvalid

An error thrown when the JWS is invalid.

Response

JWSSignatureVerificationFailed

An error returns when JWS signature verification fails.

Response

JWT Verification Failed

An error thrown for any other JWT verification failures not specifically covered by the other errors.

Response

Last updated