I have a web app, connecting to backend using cognito, all in aws services. I also have a public API method (Lambda) that does the call to cognito to do the auth and give back the session token, etc. all from backend.
The problem is that any person (who knows user pool ID and client ID) can anyway access cognito API from web directly (connecting to AWS API directly).
I don't want that. How can I define a policy so no public access to cognito is granted to users?
There's probably a few ways to go with this. Here's three ideas that come to mind.