Authentication
If you are accessing our product programatically, the following options are available to successfully authenticate.
Tip
If the following don't meet the needs of your use case, please consult the different methods available for acquiring tokens on the Official Microsoft Entra ID documentation, and of course feel free to reach out to us for support.
Beta Python SDK
See the Beta SDK Documentation for instructions.
Azure CLI
The Azure CLI simplifies the process of acquiring an access token that can be used when making requests.
Pre requisites
- Follow the How to install the Azure CLI if you haven't installed it yet.
-
Once you have a valid installation make sure you have logged in, specifying the correct scope:
Note
If you want to sign in with methods other than interactively with your personal user see the instructions on the official docs
-
To acquire an access token:
-
You can now use the
ACCESS_TOKEN
in theBearer
token when making requess to the API, for example:
-
Once you have a valid installation make sure you have logged in, specifying the correct scope:
Note
If you want to sign in with methods other than interactively with your personal user see the instructions on the official docs
-
To acquire an access token:
-
You can now use the
ACCESS_TOKEN
in theBearer
token when making requess to the API, for example:
Curl with Service Credentials
The following example uses Service Credentials to obtain an access token, which can then be used in subsequent requests. This method should be transferable to any programming language.
Note
The following is not yet supported for beta.optimeering.com
.
See Obtaining Service Credentials for instructions to poulate the environment variables CLIENT_ID
and CLIENT_SECRET
.
Generate a token by running the following:
TENANT_ID="d23844a4-14b7-4e42-9e3a-be7fcb83625b"
CLIENT_ID="<<Replace With Client ID>>"
CLIENT_SECRET="<<Replace With Client Secret>>"
ACCESS_TOKEN=$(curl -s -XPOST https://login.microsoftonline.com/$TENANT_ID/oauth2/v2.0/token -d grant_type=client_credentials -d client_id=$CLIENT_ID -d client_secret="$CLIENT_SECRET" -d scope="api://c0a9f773-6276-4d71-8df6-7239e695aff6/.default" | awk -F'"' '/access_token/{print $(NF-1)}')
You can then use the token to query the API, for example: