Obtaining and updating the API token

Obtain an API token that is required to make the API calls and retrieve license usage data from License Service Reporter. Learn how to update the token to comply with your security policies if needed.

Note: License Service Reporter is supported on OpenShift, and the best practice is to obtain and update the token by using the OpenShift console.

Obtaining an API token

Obtaining an API token by using the OpenShift console

  1. Log in to the OpenShift console of the cluster where you deployed License Service Reporter.
  2. Go to Workloads > Secrets.
  3. Set the project to All Projects.
  4. Find the ibm-license-service-reporter-token and select it.
  5. Scroll to the Data section and copy the token by using the Copy to Clipboard option.

Obtaining an API token by using the CLI

  • For Linux and OSX run the following commands.

    • Linux: oc get secret ibm-license-service-reporter-token -o jsonpath={.data.token} -n <enter the namespace of the License Service Reporter> | base64 -d
    • OSX: oc get secret ibm-license-service-reporter-token -o jsonpath={.data.token} -n <enter the namespace of the License Service Reporter> | base64 -D

    The value that you get in the response is your API token.

  • For Windows run the following command.

    • Windows: oc get secret ibm-license-service-reporter-token -o jsonpath={.data.token} -n <enter the namespace of the License Service Reporter>

    Decode the returned base64 value to reveal your API token.

Updating an API token

Important: The API token cannot contain spaces or the following characters ?,%, and &.

Updating an API token by using the OpenShift console

  1. Open the OpenShift console of the cluster where you deployed License Service Reporter.
  2. Go to Workloads > Secrets.
  3. Set the project to All Projects.
  4. Find the ibm-license-service-reporter-token and select it.
  5. From the Actions list, select Edit Secret.
  6. Edit the secret value and click Save.
  7. Restart the License Service pod.

Updating an API token by using the CLI

  1. Create a token.yml file with the following contents. Provide your new token as <TOKEN>.

    apiVersion: v1
    kind: Secret
    metadata:
      labels:
        app.kubernetes.io/component: ibm-licensing-service-svc
        app.kubernetes.io/instance: ibm-licensing-service
        app.kubernetes.io/managed-by: operator
        app.kubernetes.io/name: ibm-licensing-service-instance
        release: ibm-licensing-service
      name: ibm-license-service-reporter-token
      namespace: <enter the namespace of the License Service Reporter>
    type: Opaque
    stringData:
      token: <TOKEN>
    
  2. To apply the new token, run the following command.

    oc apply -f token.yml
    
  3. To refresh the application by deleting the pod, run the following command.

    oc delete pods -l app=ibm-license-service-reporter-instance -n <enter the namespace of the License Service Reporter>
    
  4. Restart the License Service pod.