Skip to content

Commit 3bb1de4

Browse files
anweshangermanattanasio
authored andcommitted
docs(docs): adds docs for NLC IAM authentication (watson-developer-cloud#722)
1 parent 77a878f commit 3bb1de4

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

examples/natural_language_classifier.v1.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,14 @@ var classifier = new NaturalLanguageClassifierV1({
1010
url: 'https://gateway.watsonplatform.net/natural-language-classifier/api/'
1111
});
1212

13+
// Optionally for IAM authentication
14+
/* var classifier = new NaturalLanguageClassifierV1({
15+
url: '<service_url>',
16+
version: '<version-date>',
17+
iam_apikey: '<iam_api_key>',
18+
iam_url: '<iam_url>', // optional - the default value is https://iam.bluemix.net/identity/token
19+
}); */
20+
1321
// Creating a classifier
1422
var params = {
1523
training_data: fs.createReadStream(

natural-language-classifier/v1-generated.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ class NaturalLanguageClassifierV1 extends BaseService {
3737
* @param {string} [options.url] - The base url to use when contacting the service (e.g. 'https://gateway.watsonplatform.net/natural-language-classifier/api'). The base url may differ between Bluemix regions.
3838
* @param {string} [options.username] - The username used to authenticate with the service. Username and password credentials are only required to run your application locally or outside of Bluemix. When running on Bluemix, the credentials will be automatically loaded from the `VCAP_SERVICES` environment variable.
3939
* @param {string} [options.password] - The password used to authenticate with the service. Username and password credentials are only required to run your application locally or outside of Bluemix. When running on Bluemix, the credentials will be automatically loaded from the `VCAP_SERVICES` environment variable.
40+
* @param {string} [options.iam_access_token] - An IAM access token fully managed by the application. Responsibility falls on the application to refresh the token, either before it expires or reactively upon receiving a 401 from the service, as any requests made with an expired token will fail.
41+
* @param {string} [options.iam_apikey] - An API key that can be used to request IAM tokens. If this API key is provided, the SDK will manage the token and handle the refreshing.
42+
* @param {string} [options.iam_url] - An optional URL for the IAM service API. Defaults to 'https://iam.bluemix.net/identity/token'.
4043
* @param {boolean} [options.use_unauthenticated] - Set to `true` to avoid including an authorization header. This option may be useful for requests that are proxied.
4144
* @param {Object} [options.headers] - Default headers that shall be included with every request to the service.
4245
* @param {boolean} [options.headers.X-Watson-Learning-Opt-Out] - Set to `true` to opt-out of data collection. By default, all IBM Watson services log requests and their results. Logging is done only to improve the services for future users. The logged data is not shared or made public. If you are concerned with protecting the privacy of users' personal information or otherwise do not want your requests to be logged, you can opt out of logging.
@@ -316,6 +319,9 @@ namespace NaturalLanguageClassifierV1 {
316319
/** Options for the `NaturalLanguageClassifierV1` constructor. */
317320
export type Options = {
318321
url?: string;
322+
iam_access_token?: string;
323+
iam_apikey?: string;
324+
iam_url?: string;
319325
username?: string;
320326
password?: string;
321327
use_unauthenticated?: boolean;

0 commit comments

Comments
 (0)