ibm-cloud-authentication
Use the IBM Cloud Authentication policy to authenticate with IBM Cloud and obtain an API key that can be used when sending requests to watsonx.ai.
Gateway support
Gateway | Policy version |
---|---|
DataPower® API Gateway | 1.0.0 |
This topic describes how to configure the policy in your OpenAPI source; for details on how to configure the policy in the assembly user interface, see IBM Cloud Authentication.
About
The ibm-cloud-authentication policy provides an API key to the IBM Access Manager and, if successfully authenticated, returns a Bearer token to be used by all subsequent watsonx.ai operation requests. The Bearer token is cached and will be valid for approximately 60 minutes. A new token is retrieved when a response for the API key was not cached. or expired.
Properties
The following table lists the policy properties, indicates whether a property is required, specifies the valid and default values for input, and specifies the data type of the values.
Property label | Required | Description | Data type |
---|---|---|---|
version | Yes | The policy version number. You must specify a version for the policy that is compatible with the gateway that you are using. When the API is published, if the version is incompatible with the gateway, a validation error is thrown that specifies the available versions. | string |
title | No | The title of the policy; the default value is ibm-cloud-authentication . The
title displays in the API assembly editor in the UI. |
string |
description | No | A description of the policy. | string |
apikey | Yes | The API key, or a variable reference to the variable that contains an API key. The API key is used to authenticate subsequent watsonx.ai requests. | string |
Example
- ibm-cloud-authentication:
version: 2.0.0
title: ibm-cloud-authentication
apikey: $(watsonx-ai-apikey)