Reputation: 1149
I got a graphql server running in Lambda, and everything works fine and I want my endpoint to only be accessible by authenticated users, my authentication providers are cognito identity with cognito user pool and facebook. So how can I check if the user sending request is authenticated? I'm new to AWS so, my question might confusing for AWS experts, but the main issue I have is "how can I check if the request is from authenticated user"? should I use AWS_IAM as authorizer or should custom authorizer?
What I initially did was setup a custom authorizer that checks if the accessToken from congito is valid, but I think this is not the right way and this will only work for cognito but not for facebook users.
Upvotes: 0
Views: 176
Reputation: 2620
you don't need to check anything... in API Gateway, select your lambda method, and in Method Request box, select "Auth: AWS_IAM" and then only logged in cognito users will be able to call your lambda method
Upvotes: 1