Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use as API Gateway Authorizer #74

Open
ruminize opened this issue Aug 7, 2023 · 0 comments
Open

Use as API Gateway Authorizer #74

ruminize opened this issue Aug 7, 2023 · 0 comments

Comments

@ruminize
Copy link

ruminize commented Aug 7, 2023

Can this package also be used with an API Gateway Authorizer? How does it know to only validate the access token for API Gateway routes and not redirect? How would I configure that?

Would I just set the path for "parseAuthPath" like this in the API Gateway Lambda Authorizer?

const authenticator = new Authenticator({
// Replace these parameter values with those of your own environment
region: 'us-east-1', // user pool region
userPoolId: 'us-east-1_tyo1a1FHH', // user pool ID
userPoolAppId: '63gcbm2jmskokurt5ku9fhejc6', // user pool app client ID
userPoolDomain: 'domain.auth.us-east-1.amazoncognito.com', // user pool domain

// Just add this one?
parseAuthPath: 'api.my-domain.com'
});

FYI, I tried for many days to battle cloudfront LambdaEdge using various blogs about it, including AWS blogs and it was extremely painful. I plugged in this package and it does everything I wanted. I'm not sure why I kept getting various redirects but I did. I'll have to pull apart this code to better understand it all. Thank you so much for creating it.

I did note that the viewer request lambda has a 5 second time limit. Will this package always work within that time frame?

I ask because one of the blogs I was using noted to use the origin request lambda to set the cookie and check auth due to the longer time limits of the origin lambdas.

https://cloudonaut.io/authentication-at-the-edge-with-lambda-edge-cognito/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant