After a successful authentication with the AWS Cognito Hosted UI, I am redirected to my callback url, example:
https://app.example.com/?code=16036818-2t63-4a31-98b0-e3c21aa9a24d
Using the Curl, I am able to obtain the Access Token using this request:
curl --location --request POST 'https://my-app.auth.eu-west-1.amazoncognito.com/oauth2/token'
--data-urlencode 'grant_type=authorization_code'
--data-urlencode 'client_id=47akl6j7j4grj2js419'
--data-urlencode 'code=16036818-2t63-4a31-98b0-e3c21aa9a24d'
--data-urlencode 'redirect_uri=https://app.example'
However, if I run the CURL again, it gives me this error message:
{
"error": "invalid_grant"
}
**Question: Does this exchange only happens once? **
I was expecting to get the same result.