Get Client Credentials

Product(s)
Video Cloud
Role(s)
API Developer
Topic(s)
Authentication
Ingest Profiles
API(s)
OAuth API

Introduction

The API Credentials interface in Video Cloud Studio does not always provide a way to get client credentials for API methods. In some cases, the API method is new, and simply has not been added to the Studio UI yet. In other cases, the action may be performed only via the API. However, you can still obtain them directly from the OAuth API, as explained in this topic.

The operation explained here applies to all APIs - the only thing that varies are the permissions included in the request. Note that the permissions for the APIs do not map exactly to what is shown in the Studio Admin UI - see API Operations for Client Credentials Requests for a list of available operations and their Studio equivalents.

Steps

Get your BC_TOKEN and account number

You will need to login to Studio to get your BC_TOKEN.

  1. Login to Studio as you normally do.
  2. You need your account number (referred to as the Publisher ID in Studio), which you can get by going to your account profile in Studio:
    Account Information
    Account Information
  3. With any page in Studio open, open the developer tools for the browser, go to the Console, and paste in the following code:
    var cookiesArray = document.cookie.split(";"), cookiesObj = {}, i, tmpArray = [];
    for (i = 0; i < cookiesArray.length; i++) {
        tmpArray = cookiesArray[i].split("=");
        if (tmpArray[0].indexOf('BC_TOKEN') > -1) {
            cookiesObj.BC_TOKEN = tmpArray[1];
        }
    }
    window.prompt("BC_TOKEN:", cookiesObj.BC_TOKEN);

    and press enter/return.

  4. You should see a prompt appear that contains your BC_TOKEN:
    BC_TOKEN
    BC_TOKEN
  5. If you have your BC_TOKEN, go on to the Get client credentials section; if for some reason you did not get your BC_TOKEN using the previous steps, just go to the Console, type document.cookies, and press return.
  6. All cookies for the page will be returned in a semi-colon-separated list. Find the BC_TOKEN cookie in the list, and copy the value:
    BC_TOKEN in Chrome Developer Tools
    BC_TOKEN in Chrome Developer Tools"

Get client_credentials

Now we are ready to make the call to the OAuth service to retrieve client credentials. We have to specify a client application name that we are requesting credentials for - the name is arbitrary, intended to help you keep track of what the credentials are for. We also have to specify the scope of the operations we want access to, and here we will use video-cloud/player/all perform/player/all (for the Player Management API). See API Operations for Client Credentials Requests for a list of all operations currently supported.

  1. Edit the following curl command, then paste it into the command line and press enter/return. You must provide your specific values for the following three values:
    • your BC_TOKEN
    • your credential name
    • your account id
    curl \
      --include \
      --header "Authorization: BC_TOKEN YOUR_BC_TOKEN" \
      --data 'name=YOUR_CREDENTIAL_NAME_GOES_HERE&maximum_scope=[{
          "identity": {
            "type": "video-cloud-account",
            "account-id": YOUR_ACCOUNT_ID
          },
          "operations": [
            "video-cloud/ingest-profiles/profile/read",
            "video-cloud/ingest-profiles/profile/write",
            "video-cloud/ingest-profiles/account/read",
            "video-cloud/ingest-profiles/account/write",
            "video-cloud/video/all",
            "video-cloud/notifications/all"
          ]
      }]' \
    https://oauth.brightcove.com/v4/client_credentials
  2. Copy and save the client_id and client_secret, as you will need these anytime you need to get an access_token.