Authentication

For authentication it is important to know that there are two servers.

Auth Server: https://blockchain.cargoactivity.com
API server: https://apiv2.cargoactivity.com

To authenticate first you must collect an access token from the Auth Server

To do this send a POST request to /runas. Include an "Authorization" header with the value of "Basic " + base 64 encoded "clientId:clientSecret". For the request body pass the runAsKey.

Here is an example of what the clientId, clientSecret and runAsKey should look like.

clientId: 4e6711f62e224d25bc35afe18b6e02da
clientSecret: 2E04C457DA554C8CF4A35B7C01EB89A5589E9F18BB28A14BB324DF56A528A25F
runAsKey: b39bc5450c8542578f6975c88ff5157b

The response from the Auth Server will be JSON similar to the following.

{
"accessToken": "C-79PIG-C3E3D",
"tokenType": "bearer",
"expiresIn": 604800
}

Now that you have an access token you will be able to connect to the API server. Make sure to include an "Authorization" header with the value of "Bearer " + "accessToken"

It is helpful to keep track of when the accessToken will expire. This can be calculated using the value from expiresIn which is in seconds. You can make sure to grab a new accessToken before the current one expires.

Back