Authenticating with the STEP APIs
The HTTP-based STEP APIs (REST and GraphQL) are used for machine-to-machine integrations, where no user is present to enter credentials in a browser. For that reason, protocols that require user interaction, such as SAML, cannot be used because integrations authenticate with a dedicated STEP service account.
| Method | Recommended | Description |
|---|---|---|
|
Yes |
The client application exchanges an OpenID Connect client ID and secret for an access token and passes the token with each API request. The credentials are mapped to a STEP service account. |
|
|
No |
The client application exchanges the credentials of a STEP-managed user for an access token. |
|
|
No |
The client application passes the credentials of a STEP- managed user with each request. For security reasons, basic authentication is discouraged and is only available if enabled by Stibo Systems. |
Note:
-
Users that are authenticated by an external IdP cannot be used for API authentication.
-
Always create a dedicated service account in STEP for an integration.
OIDC Client Credentials Flow
This client credentials flow is the recommended way for an integration to call the STEP APIs. It is separate from OpenID Connect user sign-in. The limitation on OpenID Connect user sign-in, described under Configuring External Authentication, does not apply. With the OpenID Connect client credentials flow, the client application exchanges a client ID and a client secret for an access token and a refresh token. The client credentials are created in the authentication broker and are mapped to a service account in STEP, so that the API requests are executed with the privileges of that account.
-
In STEP, create a service account user in an appropriate user group, with an ID that follows the naming convention 'service-account-[client ID]', for example, 'service-account-my-m2m-integration'. The client ID is derived from the user ID, so the naming convention is mandatory.
-
Enable the Externally Maintained parameter on the user and assign a random and strong password, as described in the Working with Users topic in the System Setup documentation.
-
Ensure that the group of the service account holds only the privileges that the integration needs.
-
In the Stibo Systems Support Portal, create a request for an OIDC client for API authentication. Provide the STEP system, the ID of the service account, and the email address that the client credentials are to be sent to.
-
Stibo Systems creates the client and sends the STEP system URL, the well-known configuration URL, the token endpoint, the client ID, and the client secret to the email address you provided.
-
Configure the client application with the credentials and store the client secret securely.
-
Test that the client application can obtain a token with the 'client_credentials' grant type from the token endpoint that is listed in the response from the following URL:
https://[STEP system URL]/auth/.well-known/openid-configuration
The following example obtains a token and calls the REST API with it:
Copycurl -X POST \
[token_endpoint] \
-d 'grant_type=client_credentials' \
-d 'client_id=my-m2m-integration' \
-d 'client_secret=[client secret]'
curl https://[STEP system URL]/api/v2/objects/[id] \
-H 'Authorization: Bearer [access token]'
Note: Access tokens are short-lived. The client application must request a new token, or use the refresh token, when the token expires, and must handle an HTTP 401 response by obtaining a new token rather than by retrying the request.
Pseudo OAuth
STEP exposes an endpoint that client applications can use to exchange the credentials of a STEP-managed user for an access token, by sending a POST request with a JSON request body and the content type 'application/json':
POST https://[STEP system URL]/auth/token
{
"username": "myusername",
"password": "mypassword"
}
This endpoint only works with the credentials of users that are maintained and authenticated in STEP.
Basic Authentication
Basic authentication passes the credentials of a STEP-managed user with every request. Although discouraged for security reasons, basic authentication can be enabled by Stibo Systems, for example, for existing integrations that cannot be changed immediately. Basic authentication does not work for users that are maintained and authenticated by an external IdP.