Watson Visual Recognition - Unauthorized

牧云@^-^@ 提交于 2020-01-17 02:31:05

问题


I am trying to use the Watson Visual Recognition service with the watson-developer-cloud NPM module. But I always get the following error. What am I doing wrong?

 Unauthorized: Access denied due to invalid credentials.

I already searched for hours and found many people with the same problem, but none of the answers resolved the issue.

My service authentication informations (just test data):

 {
   "apikey": "API_KEY",
   "iam_apikey_description": "...",
   "iam_apikey_name": "...",
   "iam_role_crn": "...",
   "iam_serviceid_crn": "...",
   "url": "https://gateway.watsonplatform.net/visual-recognition/api"
 }

My Node.js code to create the VisualRecognizionV3 object:

 let visualRecognition = new VisualRecognizionV3({
     api_key: "API_KEY",
     version: "2018-03-19"
 });

I will appreciate your help!


回答1:


I believe you need to specify the api_key with the iam_apikey parameter name, like this: let visualRecognition = new VisualRecognizionV3({ iam_apikey: "API_KEY", version: "2018-03-19" });

See the doc here



来源:https://stackoverflow.com/questions/51746269/watson-visual-recognition-unauthorized

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!