You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- With some service instances, you authenticate to the API by using **[IAM](#iam)**.
81
+
- In other instances, you authenticate by providing the **[username and password](#username-and-password)** for the service instance.
82
+
- Visual Recognition uses a form of [API key](#api-key) only with instances created before May 23, 2018. Newer instances of Visual Recognition use [IAM](#iam).
To find out which authentication to use, view the service credentials. You find the service credentials for authentication the same way for all Watson services:
90
86
91
-
For services that authenticate using an apikey, you can instantiate the service instance using a `Credential` object with an `apikey` and `url`.
87
+
1. Go to the IBM Cloud **[Dashboard][watson-dashboard]** page.
88
+
1. Either click an existing Watson service instance or click **Create**.
89
+
1. Click **Show** to view your service credentials.
90
+
1. Copy the `url` and either `apikey` or `username` and `password`.
92
91
93
-
**Important**: Instantiation with `apikey` works only with Visual Recognition service instances created before May 23, 2018. Visual Recognition instances created after May 22 use IAM.
92
+
In your code, you can use these values in the service constructor or with a method call after instantiating your service.
Some services use token-based Identity and Access Management (IAM) authentication. IAM authentication uses a service API key to get an access token that is passed with the call. Access tokens are valid for approximately one hour and must be regenerated.
97
+
98
+
You supply either an IAM service **API key** or an **access token**:
105
99
106
-
You can also authenticate a service using IAM authentication. You can either supply a valid access token in the `iamTokenOptions` or get an access token using an `apikey`.
100
+
- Use the API key to have the SDK manage the lifecycle of the access token. The SDK requests an access token, ensures that the access token is valid, and refreshes it if necessary.
101
+
- Use the access token if you want to manage the lifecycle yourself. For details, see [Authenticating with IAM tokens](https://console.bluemix.net/docs/services/watson/getting-started-iam.html). If you want to switch to API key, in a coroutine, override your stored IAM credentials with an IAM API key and yield until the credentials object `HasIamTokenData()` returns `true`.
107
102
103
+
#### Supplying the IAM API key
108
104
```cs
109
-
voidIEnumeratorTokenExample()
105
+
IEnumeratorTokenExample()
110
106
{
111
107
// Create IAM token options and supply the apikey.
**Important**: This type of authentication works only with Visual Recognition instances created before May 23, 2018. Newer instances of Visual Recognition use [IAM](#iam).
Copy file name to clipboardExpand all lines: Scripts/Services/Assistant/v1/README.md
-22Lines changed: 0 additions & 22 deletions
Original file line number
Diff line number
Diff line change
@@ -9,28 +9,6 @@ You complete these steps to implement your application:
9
9
10
10
* Develop your application. You code your application to connect to the Assistant workspace through API calls. You then integrate your app with other systems that you need, including back-end systems and third-party services such as chat services or social media.
11
11
12
-
### Instantiating and authenticating the service
13
-
Before you can send requests to the service it must be instantiated and credentials must be set.
Copy file name to clipboardExpand all lines: Scripts/Services/Conversation/v1/README.md
-22Lines changed: 0 additions & 22 deletions
Original file line number
Diff line number
Diff line change
@@ -9,28 +9,6 @@ You complete these steps to implement your application:
9
9
10
10
* Develop your application. You code your application to connect to the Conversation workspace through API calls. You then integrate your app with other systems that you need, including back-end systems and third-party services such as chat services or social media.
11
11
12
-
### Instantiating and authenticating the service
13
-
Before you can send requests to the service it must be instantiated and credentials must be set.
Copy file name to clipboardExpand all lines: Scripts/Services/Discovery/v1/README.md
-24Lines changed: 0 additions & 24 deletions
Original file line number
Diff line number
Diff line change
@@ -4,30 +4,6 @@ The IBM Watson™ [Discovery][discovery] service makes it possible to rapidly bu
4
4
## Usage
5
5
The IBM Watson™ [Discovery][discovery] Service uses data analysis combined with cognitive intuition in order to take your unstructured data and enrich it so that you can query it to return the information that you need from it.
6
6
7
-
### Instantiating and authenticating the service
8
-
Before you can send requests to the service it must be instantiated and credentials must be set.
Creates an environment for the service instance. Note: You can create only one environment per service instance. Attempting to create another environment for the same service instance results in an error. See the [Discovery service home page][discovery-sizing] for additional information about sizing and pricing. To create a free trial environment, specify the value of size as 0 (zero).
0 commit comments