Skip to content

How-to Guides

Generate an OAuth Token

endpoint: /api/oauth/token

An OAuth token is used as an authentication mechanism. Its main purpose is to identify you and a Live Link 365 session. Without a token, you would have to enter your credentials every time you would like to access an Live Link 365 endpoint.

To generate a token, follow these instructions:

  1. Open a new command prompt (or a terminal if you’re using Mac).
  2. Enter the following cURL command into the terminal:

    curl -X POST \
    -H 'Content-Type: application/x-www-form-urlencoded' \
    -u YOUR-APP-KEY:YOUR-SECRET -d 'grant_type=client_credentials' \
    https://livelink.sapdigitalinterconnect.com/api/oauth/token
    
    curl -X POST ^
    -H "Content-Type: application/x-www-form-urlencoded" ^
    -u YOUR-APP-KEY:YOUR-SECRET -d "grant_type=client_credentials" ^
    https://livelink.sapdigitalinterconnect.com/api/oauth/token
    

    Copying the Command

    After you copy the command, make sure you replace all placeholders with appropriate values before pasting it into any command-line interface

  3. Replace YOUR-APP-KEY and YOUR-SECRET with your actual app key and secret.

  4. Press Enter. The command will send a POST request to the Live Link 365 API's /api/oauth/token endpoint using your app key and secret combination as credentials. After a response is retrieved, cURL will then output this JSON response containing the bearer token and other related information as shown:

    {
      "access_token": "2f...........................WE",
      "token_type": "Bearer",
      "expires_in": 2700000,
      "refresh_token": "A..........N",
      "scope": "livelink:api",
      "refresh_expires_in": 3600000
    }
    

  5. Copy the token from the response and store it somewhere on your computer.

About OAuth

OAuth (or Open Authorization) is an open protocol for web transaction authentication. It provides client applications with secure access using an authentication standard that involves the creation and use of tokens

Validate an OAuth Token

endpoint: /api/oauth/token/validate

OAuth tokens usually have a validity time of 45 min and refresh tokens a time of 1 hr. To check if a token is still valid, follow these steps:

  1. Open a new command prompt (or a terminal if you’re using Mac).
  2. Enter the following cURL command into the terminal:

    curl -X POST \
    -H 'Content-Type: application/x-www-form-urlencoded' \
    -u YOUR-APP-KEY:YOUR-SECRET \
    -d 'access_token=<your-bearer-token>' \
    https://livelink.sapdigitalinterconnect.com/api/oauth/token/validate
    
    curl -X POST ^
    -H "Content-Type: application/x-www-form-urlencoded" ^
    -u YOUR-APP-KEY:YOUR-SECRET ^
    -d "access_token=<your-bearer-token>" ^
    https://livelink.sapdigitalinterconnect.com/api/oauth/token/validate
    

    Copying the Command

    After you copy the command, make sure you replace all placeholders with appropriate values before pasting it into any command-line interface

  3. Replace YOUR-APP-KEY and YOUR-SECRET with your actual app key and secret.

  4. Press Enter. The command will send a POST request to Live Link 365
  5. If the token is still within its validity period, you will receive a 200 OK response with a JSON payload similar to the following:
    {
      "scope": "livelink:api",
      "claimant": "A.............o",
      "payload": "2f......................WE",
      "roles": [
         "LIVELINK_APP"
      ]
    }
    
    where claimant and payload are the app key and secret you provided respectively. Scope denotes what parts of the service the token can access and modify and roles indicates what actions you are allowed to perform with the token within the scope.

Refresh an OAuth Token

endpoint: /api/oauth/token

If your token has expired but you're still within the 15 min window right after its expiration, you may request a new token without having to provide an app key and secret by using the refresh token that came with the one you formerly requested:

  1. Open a new command prompt (or a terminal if you’re using Mac/Linux).
  2. Enter the following cURL command into the terminal:

    curl -X POST \
    -H 'Content-Type: application/x-www-form-urlencoded' \
    -d 'grant_type=refresh_token' \
    -d 'refresh_token=<your-refresh-token>' \
    https://livelink.sapdigitalinterconnect.com/api/oauth/token
    
    curl -X POST ^
    -H "Content-Type: application/x-www-form-urlencoded" ^
    -d "grant_type=refresh_token" ^
    -d "refresh_token=<your-refresh-token>" ^
    https://livelink.sapdigitalinterconnect.com/api/oauth/token
    

    Copying the Command

    After you copy the command, make sure you replace all placeholders with appropriate values before pasting it into any command-line interface

  3. Press Enter. The command will send a POST request to Live Link 365

  4. If the refresh token is still within its validity period, you will receive a 200 OK response with a JSON payload similar to the following:
    {
      "access_token": "2.............................3",
      "token_type": "Bearer",
      "expires_in": 3599999,
      "refresh_token": "d.............4",
      "scope": "livelink:api",
      "refresh_expires_in": 14399999
    }   
    
    where claimant and payload are the app key and secret you provided respectively. Scope denotes what parts of the service the token can access and modify and roles indicates what actions you are allowed to perform with the token within the scope.

More on OAuth

For more information on OAuth and the differences between its 1.0 and 2.0 versions, please visit this site's OAuth section of our site