I have the following url to invoke services behind API Gateway: https://< random-key >.execute-api..amazonaws.com/prod/..., so far I have not enabled API Key and authorization.
Question: Is it secure enough? sb. said it is not secure because anybody can use the url to invoke my services behinds the url, not only me. One solution is I can enable API key and attach the API key as request header when invoking the url. The other solution is to use AWS Cognito, etc.
Why is it not secure? isn't < random-key > a kind of credential already? Only I know this < random-key > and I give the api url with < random-key > only to the person I trust, nobody else knows what is < random-key > of the url. And if sb. really wants to spy the < random-key >, then attaching API key does not help because if the person can steal < random-key >, he can steal the API key as well.
I understand the API Gateway can also use AWS cognito for authentication. i.e. when a person access the url, he will be asked to input credential (user/password), but again, this credential can also be stolen, the same as how the < random-key > and API Key can be stolen.
IMO, using < random-key > and the API key and the credential are the same thing. so that is why I think I just need to set API Gateway as public without enable API Gateway and AWS cogonito.
Am I correct? Can anybody explain why having API Gateway or AWS cognito is more secure than without using them?
Another question related to the above question: since the url uses https, will the url itself (including < random-key > ) not be encrypted while the request header like API key, and the content like username/password be encrypted?