Authorizing Your API Against Envase Connect
Once you have acquired your client credentials, you can use them to make a Basic authorization call to any of the following URLs:
Test:
https://envase-dev.auth.us-east-1.amazoncognito.com/oauth2/token
Sandbox:
https://envase-stg.auth.us-east-1.amazoncognito.com/oauth2/token
Production:
https://envase.auth.us-east-1.amazoncognito.com/oauth2/token
You will also need to provide the following query parameters and make sure they are x-www-form-urlencoded:
grant_type=client_credentials
scope=connectdata/events
The full URL will then look as follows:
https://envase-dev.auth.us-east-1.amazoncognito.com/oauth2/token?scope%3Dconnectdata%2Fevents%26grant_type%3Dclient_credentials
When successful, this call will return a JSON Web Token (JWT) that can be used as the authentication header when publishing events. This JWT will remain valid for 1 hour.
Example Using Curl
curl --location --request POST 'https://envase-dev.auth.us-east-1.amazoncognito.com/oauth2/token'
--header 'Authorization: Basic N2RtcDI2OGhoOTRoNDBrZWg1MHZucmNjZzE6dmN2Z2M4dTZ0M2NkZTMxZHJkM3V2OTdoOHZoMGFsdmo5bXBndWVkaXI0ZWlkcTNpbnM3'
--header 'Content-Type: application/x-www-form-urlencoded'
--data-urlencode 'scope=connectdata/events'
--data-urlencode 'grant_type=client_credentials'