Error: Argument error: username and password are required unless use_unauthenticated is set
Error: Argument error: username and password are required unless use_unauthenticated is set
我正在尝试通过 iam apikey 使用 STT 服务。
如果我像 documentation shows 那样设置 IAM 凭据(如下),我会收到错误消息:需要用户名和密码,除非设置了 use_unauthenticated
let speech_to_text = new SpeechToTextV1({
iam_apikey: STT_credentials.apikey,
iam_url: STT_credentials.url
});
如果我传递 use_anauthenticated 值,我会收到 401 响应:
let speech_to_text = new SpeechToTextV1({
iam_apikey: STT_credentials.apikey,
iam_url: STT_credentials.url,
use_unauthenticated: true
});
回复:
Error! Code:401 Type: undefined Message: Unauthorized
如果我在错误中查看文件:
/Users/jward/Desktop/speech_lab_assets/STT/node_mod
ules/watson-developer-cloud/lib/base_service.js:73:13
我看到如果没有 username/password param:
它会抛出一个错误
if (!options.use_unauthenticated) {
if (!options.username || !options.password) {
throw new Error('Argument error: username and password are required unless use_unauthenticated is set');
}
如果 username/password 是 watson-developer-cloud 工具的要求,我该如何使用 IAM?这是节点模块的问题还是我做错了什么?
我正在使用 watson-developer-cloud@2.42.0
端点指定为 url
而不是您所拥有的 iam_url
。
这对我有用 -
const STTV1 = require('watson-developer-cloud/speech-to-text/v1');
let sttService = new STTV1({
url: url,
iam_apikey = apikey
});
我正在尝试通过 iam apikey 使用 STT 服务。
如果我像 documentation shows 那样设置 IAM 凭据(如下),我会收到错误消息:需要用户名和密码,除非设置了 use_unauthenticated
let speech_to_text = new SpeechToTextV1({
iam_apikey: STT_credentials.apikey,
iam_url: STT_credentials.url
});
如果我传递 use_anauthenticated 值,我会收到 401 响应:
let speech_to_text = new SpeechToTextV1({
iam_apikey: STT_credentials.apikey,
iam_url: STT_credentials.url,
use_unauthenticated: true
});
回复:
Error! Code:401 Type: undefined Message: Unauthorized
如果我在错误中查看文件:
/Users/jward/Desktop/speech_lab_assets/STT/node_mod
ules/watson-developer-cloud/lib/base_service.js:73:13
我看到如果没有 username/password param:
它会抛出一个错误if (!options.use_unauthenticated) {
if (!options.username || !options.password) {
throw new Error('Argument error: username and password are required unless use_unauthenticated is set');
}
如果 username/password 是 watson-developer-cloud 工具的要求,我该如何使用 IAM?这是节点模块的问题还是我做错了什么?
我正在使用 watson-developer-cloud@2.42.0
端点指定为 url
而不是您所拥有的 iam_url
。
这对我有用 -
const STTV1 = require('watson-developer-cloud/speech-to-text/v1');
let sttService = new STTV1({
url: url,
iam_apikey = apikey
});