Context
I have a S3 bucket with static files. In front of this bucket, i have Cloudfront, triggering a lambda@edge function on each viewer request. My lambda function is based on this following project:
https://github.com/Widen/cloudfront-auth
What i want: Make my S3 bucket acessible only after login (I'm using AUTH 0).
Issue
After login screen, i get a infinity loop of redirects between auth0/cloudfront and recieve too_many_requests:
Configs
Lambda
{
"AUTH_REQUEST": {
"client_id": "<myId>",
"response_type": "code",
"scope": "openid email",
"redirect_uri": "https://<myCF>.cloudfront.net"
},
"TOKEN_REQUEST": {
"client_id": "<myId>",
"client_secret": "<myRandomGeneratedSecret>",
"redirect_uri": "https://<myCF>.cloudfront.net",
"grant_type": "authorization_code"
},
"DISTRIBUTION": "serverlessAuth",
"AUTHN": "AUTH0",
"PRIVATE_KEY": "<KEY>",
"PUBLIC_KEY": "<KEY>",
"DISCOVERY_DOCUMENT": "https://<myAuth0>.auth0.com/.well-known/openid-configuration",
"SESSION_DURATION": 259200,
"BASE_URL": "https://<myAuth0>.us.auth0.com",
"CALLBACK_PATH": "/_callback",
"AUTHZ": "AUTH0"
}
CloudFront Config
Auth0 Config
Only social connection with google Enabled:
Seems to be working fine, testing inside auth0 connection test:
My Auth0 Config:
Additional Info:
My Cloudfront redirects to a S3 bucket with static files (docusaurus generated).
FF Tools:
My requests keeps in a infinity loop 'till error:
Can someone help me? What i'm doing wrong? I'm almost giving up :/