Authorization and authentication

The steps below will help you start your integration with NDD Cargo.

Credentials

Before integrating, you must obtain your credentials (clientId and secret) to generate an access token. This token validates your requests and secures data exchange.

Where do I get my credentials?

Credentials are provided by NDD and include:

  • clientId

  • secret

  • scope

Scope

Description

api://CargoAPI.integration/.default

API that enables integration with NDD Cargo

These credentials allow your system to obtain a JWT token using the Client Credentials (M2M) flow via Microsoft Entra ID.


Get Access Token

The access token is used to authenticate requests to the API (e.g., creating trips, drivers, or branches).

Use your clientId, secret, and scope in a REST client with the following configuration:

  • Method: POST

  • URL: https://login.microsoftonline.com/{tenant_id}/oauth2/v2.0/token

  • Headers:

    • Content-Type: application/json

  • Body:

    • Send the clientId, secret, scope, and grant_type in the request body.

{
  "clientId": "abc123456789xyz",
  "secret": "shhItsASecretKey09876",
  "scope": "api://CargoAPI.integration/.default",
  "grant_type": "client_credentials"
}
  • The grant_type must always be set to client_credentials.

  • To specify multiple scopes, separate each scope with a space.


Response

The API returns:

  • accessToken: Authorization token

  • expiresIn: Token expiration time (in minutes)

{
  "accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6Ik5ERCBFbG9nIiwiaWF0IjoxNTE2MjM5MDIyfQ.sqF8-Z6lD8mO-BHgKDaG8W9cvEZexEBsR5p1W-9UcsY",
  "expiresIn": 3600
}

You must request a new token after it expires.


Using the Token

Include the token in the Authorization header for all subsequent requests:

Authorization: Bearer {accessToken}