Obtaining credentials
M2M clients are provisioned by Classiq rather than created self-service. To obtain credentials, contact your Classiq account manager or sales representative and request an M2M client for your account. Once the client is created, Classiq delivers the credentials over a secured channel to avoid exposing the secret in transit:- You receive an encrypted link to the credential details.
- Access is protected by a one-time verification code sent to your recipient email address when you open the link.
Configuring the environment
First, make sure you have the latest Classiq SDK installed:CLASSIQ_CLIENT_ID and CLASSIQ_CLIENT_SECRET are present, it authenticates silently and skips the interactive browser login entirely.
| Variable | Required | Purpose |
|---|---|---|
CLASSIQ_CLIENT_ID | Yes | The M2M client identifier. |
CLASSIQ_CLIENT_SECRET | Yes | The client secret paired with the ID. |
CLASSIQ_ORG_ID | No | Selects an organization when the client has access to several. |
Authenticating with M2M credentials
You callclassiq.authenticate() exactly as in the interactive flow. With the variables set, it detects the M2M credentials and uses them instead of opening a browser, so the same code runs unattended.
The M2M flow takes priority over any credentials cached from a previous interactive login on the same machine. M2M tokens are held in memory for the lifetime of the process and are not written to disk, so each new process authenticates fresh.
Troubleshooting
If authentication fails, the SDK raises:401 access_denied
401 access_denied
A
401 access_denied response means the credentials were rejected or the SDK version does not support the M2M flow. Work through these checks:-
Verify the version. Confirm you are running an up-to-date Classiq SDK:
-
Verify the variables. Confirm the client ID is exported in the environment running your code:
On Windows PowerShell, use
echo $env:CLASSIQ_CLIENT_IDinstead. If it prints nothing, the variables are not set in the current session. Re-export them, and make sure your CI/CD job or scheduler passes them through to the process.