File tree Expand file tree Collapse file tree 1 file changed +28
-21
lines changed
Expand file tree Collapse file tree 1 file changed +28
-21
lines changed Original file line number Diff line number Diff line change @@ -62,29 +62,36 @@ async function main() {
6262 const policy = {
6363 Version : '2012-10-17' ,
6464 Statement : [
65- // Allow authenticated Cognito users
6665 {
67- Effect : 'Allow' ,
68- Principal : '*' ,
69- Action : 'execute-api:Invoke' ,
70- Resource : `arn:aws:execute-api:${ REGION } :*:${ api . id } /*/*` ,
71- Condition : {
72- StringEquals : {
73- 'cognito-identity.amazonaws.com:aud' : cognitoUserPoolId
66+ "Version" : "2012-10-17" ,
67+ "Statement" : [
68+ // Allow OPTIONS requests
69+ {
70+ "Effect" : "Allow" ,
71+ "Principal" : "*" ,
72+ "Action" : "execute-api:Invoke" ,
73+ "Resource" : "arn:aws:execute-api:us-east-1:*:xhvwo6wp66/*/OPTIONS/*"
74+ } ,
75+ {
76+ // Allow all other requests - authentication will be handled by Cognito
77+ "Effect" : "Allow" ,
78+ "Principal" : "*" ,
79+ "Action" : "execute-api:Invoke" ,
80+ "Resource" : "arn:aws:execute-api:us-east-1:*:xhvwo6wp66/*/*"
81+ } ,
82+ {
83+ // Deny non-HTTPS requests
84+ "Effect" : "Deny" ,
85+ "Principal" : "*" ,
86+ "Action" : "execute-api:Invoke" ,
87+ "Resource" : "arn:aws:execute-api:us-east-1:*:xhvwo6wp66/*/*" ,
88+ "Condition" : {
89+ "Bool" : {
90+ "aws:SecureTransport" : "false"
91+ }
92+ }
7493 }
75- }
76- } ,
77- // Deny non-HTTPS requests
78- {
79- Effect : 'Deny' ,
80- Principal : '*' ,
81- Action : 'execute-api:Invoke' ,
82- Resource : `arn:aws:execute-api:${ REGION } :*:${ api . id } /*/*` ,
83- Condition : {
84- Bool : {
85- 'aws:SecureTransport' : 'false'
86- }
87- }
94+ ]
8895 }
8996 ]
9097 } ;
You can’t perform that action at this time.
0 commit comments