Knowledge Base

Authentication

Authentication

Cloudmore API uses the Open Authorization (OAuth) 2.0 authorization framework for token-based authentication.

OAuth is an open standard that provides secure access to protected resources.

To use the Cloudmore API, you need to request an access token. After you receive an access token, include the access token in the header of all requests to the Cloudmore API.

An access token is valid for 24 hours. Please use the same access token until it is about to expire.

To request an access token, you will need the following:

  1. API secret provided by Cloudmore.

  2. API user username (created in Cloudmore)

  3. API user password (created in Cloudmore)

Encode API SECRET

To request an access token for the Cloudmore API, your API credentials must be encoded into a Base64 string. Most programming languages offer built-in functions to handle Base64 encoding, and there are also online tools available for quick encoding.

You should encode your credentials in the format:
client_id:client_secret

For example, if your clientId is ro.customer.client, you would combine it with your clientSecret, then encode the full string into Base64. This encoded string is then included in your authentication request to securely access the API.

Example of a base64 encoded string: cm7iy4MZeH8tZxIpY3xpZW60OkBsb4VkWGg5cmvPUT2TZWMyMzc=

Request Access Token

To get an access token from Cloudmore Authentication API, make a request to: https://api.cloudmore.com/connect/token

In the following request, the Authorization base64 string and {username} and {password} need to be updated with actual values.

Curl to Fetch the Access Token
Bash
curl -X POST https://api.cloudmore.com/connect/token \
-H 'Content-Type: application/x-www-form-urlencoded' \
-H 'Authorization: Basic VGhpc0lzTXlQYXNzd29yZA==' \
-d 'grant_type=password&username={username}&password={password}&scope=api'

Important fields related to requesting an access token:

  1. Authorization: The text Basic followed by a space and the base64 encoded API secret.

    Example: “Basic VGhpc0lzTXlQYXNzd29yZA==”

  2. grant_type: The grant type value for the client credentials grant mechanism. The value must be password&username and the credentials for the API accounts need to be submitted.

    Example: grant_type=password&username={myuser@broker.com}&password={myPassword}&scope=api’

  3. scope: The scope of the access request. The value must be api.

The response from the API is as follows:

JSON
{
 "access_token":"eyJhbGciOiJSUzI1NiIsImtpZCI6IkMzRERCQTEzNkU4MzFDN...",
 "expires_in":86400,
 "token_type":"Bearer"
}

Important fields related to response:

  1. access_token: The generated access token that is used to authorize your API requests.
    To prove your identity, you must include an access token in the header of all requests you make to the Cloudmore API. Use the token as the value of the Authorization parameter in the API request header.

  2. token_type: The type of token generated. The value is always Bearer.

  3. expires_in: The amount of time until the access token expires, in seconds. The value is always 86400.

Access Token Expiration

When you generate an access token in Cloudmore, it remains valid for 24 hours (86400 seconds). You can continue using the same token for API requests until it expires. After expiration, you’ll need to request a new token. If you try to use an expired token, the system will respond with a 401 Unauthorized error.

To manage token renewal, you can either:

  • Track the time since the token was issued and request a new one before it expires (based on the expires_in value).

  • Wait for a 401 error, then immediately request a new token when it occurs.