Receipt of Waste - API Authentication Guide
To start using the Receipt API, you need your Client ID and Secret which you should have received via email. You will need this to apply to the OAuth service for an access token.
This process involves two steps:
- Submit the client id and secret to the OAuth service to be granted an access token.
import requests #use requests library import base64 def get_cognito_token(client_id, client_secret, token_url): # your clientID, Client Secret and OAuth URL client_credentials = f"{client_id}:{client_secret}" encoded_credentials = base64.b64encode(client_credentials.encode()).decode() headers = { "Authorization": f"Basic {encoded_credentials}", "Content-Type": "application/x-www-form-urlencoded" } payload = { "grant_type": "client_credentials", "client_id": client_id, "client_secret": client_secret, } response = requests.post(f"{token_url}/oauth2/token", headers=headers, data=payload) response.raise_for_status() token_response = response.json() return token_response["access_token"] - Submit the access/bearer token to use the API.
import requests def make_api_request(access_token, api_url): # your access token and the api url here headers = { "Authorization": f"Bearer {access_token}" } response = requests.get(api_url, headers=headers) response.raise_for_status() return response.json()
Sequence Diagram for Authentication Flow
Authentication sequence diagram
What is the OAuth login URL for my API?
Production: https://waste-movement-external-api-75ee2.auth.eu-west-2.amazoncognito.com
Test: https://waste-movement-external-api-8ec5c.auth.eu-west-2.amazoncognito.com
Testing your credentials
You can test your credentials using the following cURL and Python scripts. If the scripts return an error, your credentials were entered incorrectly. If the scripts return an access token then your credentials are correct.
Two cURL and Python example scripts are provided, one each for the production and test environments.
In the cURL scripts replace $CLIENTID with your client ID and replace $CLIENTSECRET with your client secret.
In the Python scripts under Test credentials, replace "YOUR_CLIENT_ID" with your client ID and replace "YOUR_CLIENT_SECRET" with your client secret.
Production Environment
curl --request POST \
--url "https://waste-movement-external-api-75ee2.auth.eu-west-2.amazoncognito.com/oauth2/token" \
--user "$CLIENTID:$CLIENTSECRET" \
--header "Content-Type: application/x-www-form-urlencoded" \
--data "grant_type=client_credentials"
Test Environment
curl --request POST \
--url https://waste-movement-external-api-8ec5c.auth.eu-west-2.amazoncognito.com/oauth2/token \
--user "$CLIENTID:$CLIENTSECRET" \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data 'grant_type=client_credentials'
Python Examples
Production Environment
import requests
def get_access_token(client_id, client_secret):
response = requests.post("https://waste-movement-external-api-75ee2.auth.eu-west-2.amazoncognito.com",
auth=(client_id, client_secret),
data={
"grant_type": "client_credentials"
}
)
response.raise_for_status()
return response.json()["access_token"]
# Test credentials
client_id = "YOUR_CLIENT_ID"
client_secret = "YOUR_CLIENT_SECRET"
try:
access_token = get_access_token(client_id, client_secret)
print("Authentication successful")
print("Access Token:")
print(access_token)
except requests.exceptions.HTTPError as e:
print(f"Authentication failed: {e}")
except requests.exceptions.RequestException as e:
print(f"Request failed: {e}")
Test Environment
import requests
def get_access_token(client_id, client_secret):
response = requests.post("https://waste-movement-external-api-8ec5c.auth.eu-west-2.amazoncognito.com/oauth2/token",
auth=(client_id, client_secret),
data={
"grant_type": "client_credentials"
}
)
response.raise_for_status()
return response.json()["access_token"]
# Test credentials
client_id = "YOUR_CLIENT_ID"
client_secret = "YOUR_CLIENT_SECRET"
try:
access_token = get_access_token(client_id, client_secret)
print("Authentication successful")
print("Access Token:")
print(access_token)
except requests.exceptions.HTTPError as e:
print(f"Authentication failed: {e}")
except requests.exceptions.RequestException as e:
print(f"Request failed: {e}")
Page last updated on October 21st 2026.