Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 12 Next »

Table of contents

Before you start you need to obtain the following information

CLIENT_ID="my client id"
CLIENT_SECRET="my client secret"

To get this information, please contact support@ambita.com

Obtain a token for the frontend components

In order to obtain a token, run the following with grant_type trusted in your backend application

curl -s -H  "Content-Type: application/json" https://beta-api.ambita.com:443/authentication/v2/token -d "
        {
                \"grant_type\": \"trusted\",
                \"client_id\": \"CLIENT_ID\",
                \"client_secret\": \"CLIENT_SECRET\"
                \"username\": \"user1\"
        }"

Example response

{
  "access_token": "ej577asf-a5k6-42yq-a3a2-fh03hb8cb58c",
  "token_type": "Bearer",
  "expires_in": 3600,
  "refresh_token": "aj274ajd-t1s8-48sk-v5m1-shf64j9bq25a",
  "scope": [
    "infoland.flex"
  ]
}

Obtain a token for your backend

In order to obtain a token, run the following with grant_type client_credentials

curl -s -H  "Content-Type: application/json" https://beta-api.ambita.com:443/authentication/v2/token -d "
        {
                \"grant_type\": \"client_credentials\",
                \"client_id\": \"CLIENT_ID\",
                \"client_secret\": \"CLIENT_SECRET\"
        }"

Example response

{
  "access_token": "ej577asf-a5k6-42yq-a3a2-fh03hb8cb58c",
  "token_type": "Bearer",
  "expires_in": 3600,
  "refresh_token": "aj274ajd-t1s8-48sk-v5m1-shf64j9bq25a",
  "scope": [
    "infoland.flex"
  ]
}

The token should be a request header and should be added in the Authorization header as shown below in every call to our api from your backend, except when obtaining the token.

curl -s \
      -H "Content-Type: application/json" \
      -H "Authorization: Bearer ej577asf-a5k6-42yq-a3a2-fh03hb8cb58c" \
      .....

More information about OAuth can be found here: https://www.oauth.com/

  • No labels