Skip to main content

AWS Cognito JWT Auth Policy

Authenticate requests with JWT tokens issued by AWS Cognito. This is a customized version of the OpenId JWT Policy specifically for AWS Cognito.


"name": "my-cognito-jwt-auth-inbound-policy",
"policyType": "cognito-jwt-auth-inbound",
"handler": {
"export": "CognitoJwtInboundPolicy",
"module": "$import(@zuplo/runtime)",
"options": {
"allowUnauthenticatedRequests": false,
"region": "$env(AWS_REGION)",
"userPoolId": "$env(AWS_COGNITO_USER_POOL_ID)"
  • name the name of your policy instance. This is used as a reference in your routes.
  • policyType the identifier of the policy. This is used by the Zuplo UI. Value should be cognito-jwt-auth-inbound.
  • handler/export The name of the exported type. Value should be CognitoJwtInboundPolicy.
  • handler/module the module containing the policy. Value should be $import(@zuplo/runtime).
  • handler/options The options for this policy:
    • allowUnauthenticatedRequests

      Allow unauthenticated requests to proceed. This is use useful if you want to use multiple authentication policies or if you want to allow both authenticated and non-authenticated traffic.

    • region

      The AWS region where your Cognito instance is deployed

    • userPoolId

      The user pool identifier

Read more about how policies work