I have implemented the following code in my plain JavaScript webpage:
const http = new XMLHttpRequest()
http.open("GET", "<CognitoPoolDomainName>.auth.eu-central-1.amazoncognito.com/oauth2/userInfo");
http.setRequestHeader("Authorization", "Bearer " + jwtToken);
http.send();
http.onload = () => console.log(http.responseText);
});
the jwt token can be decrypt well in https://jwt.io/.
But I am getting this error message:
{"error":"invalid_token","error_description":"Access token is used against invalid domain"}
Can you help me tin understand what token - in which format - is required by this API Endpoint? https://docs.aws.amazon.com/cognito/latest/developerguide/userinfo-endpoint.html
Many thanks!