12345678910111213141516171819202122232425 |
- #! /bin/bash
- pushd terraform
- CLIENT_ID=$( terraform output --raw cognito_client_id )
- ENDPOINT=$( terraform output --raw test_api_endpoint )
- RAW=$( curl --location --request POST 'https://cognito-idp.us-east-2.amazonaws.com' \
- --header 'X-Amz-Target: AWSCognitoIdentityProviderService.InitiateAuth' \
- --header 'Content-Type: application/x-amz-json-1.1' \
- --data-raw '{
- "AuthParameters" : {
- "USERNAME" : "fdamstra",
- "PASSWORD" : "Bluem00n"
- },
- "AuthFlow" : "USER_PASSWORD_AUTH",
- "ClientId" : "'${CLIENT_ID}'"
- }'
- )
- ACCESS_TOKEN=$( echo "$RAW" | jq '.AuthenticationResult.AccessToken' -r )
- echo RUN:
- echo \ \ \ \ ACCESS_TOKEN="${ACCESS_TOKEN}"
- echo \ \ \ \ curl --request GET \'"${ENDPOINT}"/example\' --header \"Authorization: Bearer \${ACCESS_TOKEN}\"
- popd
|