I'm attempting to use STT service with the iam apikey.
If I set the IAM credentials like the documentation shows (below) I get the error: username and password are required unless use_unauthenticated is set
let speech_to_text = new SpeechToTextV1({
iam_apikey: STT_credentials.apikey,
iam_url: STT_credentials.url
});
If I pass the use_anauthenticated value I get a 401 response:
let speech_to_text = new SpeechToTextV1({
iam_apikey: STT_credentials.apikey,
iam_url: STT_credentials.url,
use_unauthenticated: true
});
response:
Error! Code:401 Type: undefined Message: Unauthorized
If I look at the file in the error:
/Users/jward/Desktop/speech_lab_assets/STT/node_mod
ules/watson-developer-cloud/lib/base_service.js:73:13
I see that it will throw an error if there is no 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');
}
How am I supposed to use IAM if the username/password is a requirement of the watson-developer-cloud tooling? Is this an issue with the node module or am I doing something wrong?
I am using watson-developer-cloud@2.42.0
The endpoint is specified as url
and not iam_url
as you have it.
This works for me -
const STTV1 = require('watson-developer-cloud/speech-to-text/v1');
let sttService = new STTV1({
url: url,
iam_apikey = apikey
});