Authentication for REST APIs

The Goods owner REST API and the Automation REST API support two authentication methods: OAuth 2.0 client credentials (recommended) and classic Basic authentication (username and password). This page describes authentication for these REST APIs, not the SOAP APIs.

Table of contents

OAuth 2.0 (client credentials)

With the client_credentials grant, your integration exchanges a client ID and client secret for a short-lived access token, which you then use instead of a username/password on every API request.

Getting a client ID and client secret

Your client ID and client secret are generated when the administrator of the warehouse system creates an API user with OAuth authentication enabled. Follow this guide to find out how to set up the API user and choose OAuth as its authentication type.

Once the user has been created:

  • The client ID is shown directly in the admin UI.
  • The client secret is never shown in the UI. Instead, a one-time retrieval link is emailed to the address registered on the API user. The link expires after a limited time, so make sure to retrieve and store the secret securely as soon as you receive the email.

If you lose the client secret, or it has expired before you retrieved it, ask the administrator to resend the credential email. This issues a new client secret - the old one is revoked.

Requesting an access token

Request an access token by posting to the token endpoint:

POST https://login.ongoingwms.com/connect/token
Content-Type: application/x-www-form-urlencoded

grant_type=client_credentials&client_id={your client id}&client_secret={your client secret}&scope={space separated scopes}
Token request parameters
grant_type str Always client_credentials
client_id str Your client ID
client_secret str Your client secret
scope str Space separated list of the scopes you want on the token. See the goods owner, Automation API or MCP scopes pages for the full list.

The scope parameter is optional, but a token can never be granted more scopes than your API user was configured with. If you omit it, or request a scope which your API user does not have, the resulting token simply will not include that scope.

A successful response looks like this:

{
  "access_token": "eyJhbGciOi...",
  "token_type": "Bearer",
  "expires_in": 3600
}

Using the access token

Include the access token as a bearer token on every REST/Automation API request, instead of the Authorization: Basic ... header used with username/password authentication:

Authorization: Bearer {access_token}

If a request is missing a required scope, the API responds with HTTP 403 and a body similar to:

{
  "message": "Missing required scope 'goodsowner:articles:read'"
}

Token expiry

Access tokens are short-lived (see the expires_in field, in seconds, on the token response). There is no interactive refresh step for client credentials - when your token is close to expiring, or an API request fails with an authentication error, simply request a new token the same way, using your client ID and client secret again.

We recommend caching the access token for its lifetime and only requesting a new one when it is about to expire, rather than requesting a new token for every API call.

Basic authentication

With Basic authentication, you send your API user's username and password on every request using the standard HTTP Authorization: Basic header:

Authorization: Basic {base64(username:password)}

Basic authentication gives full access to all scopes.