Get your access token
Send a request
Get your API access token
import requests
from dotenv import dotenv_values
# An example of how to manage your Client ID and Client Secret, using a .env file
secrets = dotenv_values(".env")
client_id = secrets["CLIENT_ID"]
client_secret = secrets["CLIENT_SECRET"]
# add the
headers = {
"Content-Type": "application/x-www-form-urlencoded"
}
body = {"grant_type": "client_credentials"}
# url to retrieve your access token
url = "https://demo-api.certn.co/token/"
# Send the HTTP request to the API via POST,
# including your Client ID and Client Secret for authentication
response = requests.post(
url,
headers=headers,
auth=(client_id, client_secret),
data=body
)
# retrieve the access token
access_token = response.data.get("access_token")Errors
Last updated
Was this helpful?
