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
When authenticating with IAM, you have the option of passing in the IAM API key, the IAM URL, and an IAM access token. **Be aware that passing in an access token means that you're assuming responsibility for maintaining that token's lifecycle.** If you instead pass in an IAM API key, the SDK will manage it for you.
173
+
When authenticating with IAM, you have the option of passing in:
174
+
- the IAM API key and, optionally, the IAM service URL
175
+
- an IAM access token
176
+
177
+
**Be aware that passing in an access token means that you're assuming responsibility for maintaining that token's lifecycle.** If you instead pass in an IAM API key, the SDK will manage it for you.
174
178
175
179
```java
176
180
// in the constructor, letting the SDK manage the IAM token
177
181
IamOptions options =newIamOptions.Builder()
178
182
.apiKey("<iam_api_key>")
179
-
.url("<iam_url>")
183
+
.url("<iam_url>")// optional - the default value is https://iam.ng.bluemix.net/identity/token
180
184
.build();
181
185
Discovery service =newDiscovery("2017-11-07", options);
182
186
```
@@ -186,26 +190,23 @@ Discovery service = new Discovery("2017-11-07", options);
186
190
Discovery service =newDiscovery("2017-11-07");
187
191
IamOptions options =newIamOptions.Builder()
188
192
.apiKey("<iam_api_key>")
189
-
.url("<iam_url>")
190
193
.build();
191
194
service.setIamCredentials(options);
192
195
```
193
196
194
197
```java
195
-
// in the constructor, taking control of managing IAM token
198
+
// in the constructor, assuming control of managing IAM token
196
199
IamOptions options =newIamOptions.Builder()
197
200
.accessToken("<access_token>")
198
-
.url("<iam_url>")
199
201
.build();
200
202
Discovery service =newDiscovery("2017-11-07", options);
201
203
```
202
204
203
205
```java
204
-
// after instantiation, taking control of managing IAM token
206
+
// after instantiation, assuming control of managing IAM token
0 commit comments