node-sdk icon indicating copy to clipboard operation
node-sdk copied to clipboard

Natural Language Understanding not authorized

Open tempoc opened this issue 7 years ago • 1 comments

Overview Following https://github.com/watson-developer-cloud/node-sdk#credentials-file-easier for watson-developer-cloud/natural-language-understanding/v1 fails to authenticate based on downloaded ibm-credentials.env file.

Expected behavior Upon provisioning Natural Language Understanding and downloading ibm-credentials.env file into working directory, calling the nlu.analyze() function should authenticate correctly.

Actual behavior nlu.analyze() failed to authenticate. Debugging revealed that properties in downloaded file include property key

NATURAL_LANGUAGE_UNDERSTANDING_APIKEY but expected property key was

NATURAL_LANGUAGE_UNDERSTANDING_API_KEY.

Upon rectifying the error by manually renaming the property on the ibm-credentials.env file the call failed to authenticate because instead of sending the key in the apikey:<key_goes_here> authentication mode, it's passed as a URL parameter instead as so: https://gateway.watsonplatform.net/natural-language-understanding/api/v1/analyze?api_key=key_goes_here&version=2018-03-19

Temporary workaround is to rename properties on ibm-credentials.env such that the following are used:

NATURAL_LANGUAGE_UNDERSTANDING_USERNAME=apikey
NATURAL_LANGUAGE_UNDERSTANDING_PASSWORD=<key_goes_here>

How to reproduce Attempt to use nlu.analyze() with a freshly downloaded ibm-credentials.env file and no other means of authentication.

SDK Version 3.18.4

Additional information:

  • OS: macOS Mojave 10.14.3 (18D109)
  • Node: v10.12.0

Related May be what #617 was experiencing at some point.

tempoc avatar Mar 28 '19 22:03 tempoc

@tempoc Thanks for the issue. The key should actually be NATURAL_LANGUAGE_UNDERSTANDING_IAM_APIKEY. This was a bug in the credentials file that we noticed last week and should now be resolved.

Closing this issue since I am 99.9% sure that was your issue, feel free to re-open if it still doesn't work for you.

dpopp07 avatar Apr 12 '19 18:04 dpopp07