I wrapped the API made using Express with API Gateway. And I am using Cognito Userpool to authenticate API Gateway.
When I accessed that API using Angular2 http service, normal value returned. However, when authentication fails, it gets the following error.
No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:3000' is therefore not allowed access. The response had HTTP status code 401.
I correctly set up the header mapping, but this time I get this error.
When I access it using Postman, I get the following result.
{
"message": "Unauthorized"
}
I also want this same result when accessing with Angular2.
Is that possible?