Obtaining and updating an 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
- Log in to the OpenShift console of the cluster where you deployed License Service Reporter.
- Go to Workloads > Secrets.
- Set the project to All Projects.
- Find the ibm-licensing-reporter-token and select it.
- 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-licensing-reporter-token -o jsonpath={.data.token} -n ibm-common-services | base64 -d
-
OSX:
oc get secret ibm-licensing-reporter-token -o jsonpath={.data.token} -n ibm-common-services | 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-licensing-reporter-token -o jsonpath={.data.token} -n ibm-common-services
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
- Open the OpenShift console of the cluster where you deployed License Service Reporter.
- Go to Workloads > Secrets.
- Set the project to All Projects.
- Find the ibm-licensing-reporter-token and select it.
- From the Actions list, select Edit Secret.
- Edit the secret value and click Save.
- Restart the License Service pod.
Updating an API token by using the CLI
-
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-licensing-reporter-token namespace: ibm-common-services type: Opaque stringData: token: <TOKEN>
-
To apply the new token, run the following command.
oc apply -f token.yml
-
To refresh the application by deleting the pod, run the following command.
oc delete pods -l app=ibm-license-service-reporter-instance -n ibm-common-services
-
Restart the License Service pod.