@@ -25,12 +25,7 @@ module.exports = function (RED) {
25
25
pkg = require ( '../../package.json' ) ,
26
26
serviceutils = require ( '../../utilities/service-utils' ) ,
27
27
payloadutils = require ( '../../utilities/payload-utils' ) ,
28
- iamutils = require ( '../../utilities/iam-utils' ) ,
29
28
sttutils = require ( './stt-utils' ) ,
30
- //AuthV1 = require('watson-developer-cloud/authorization/v1'),
31
- //AuthIAMV1 = require('ibm-cloud-sdk-core/iam-token-manager/v1'),
32
- //AuthIAMV1 = require('ibm-cloud-sdk-core/auth/iam-token-manager-v1'),
33
- //AuthIAMV1 = require('ibm-cloud-sdk-core/auth/token-managers/iam-token-manager'),
34
29
{ IamTokenManager } = require ( 'ibm-watson/auth' ) ;
35
30
muteMode = true , discardMode = false , autoConnect = true ,
36
31
apikey = '' , sApikey = '' ,
@@ -323,33 +318,9 @@ module.exports = function (RED) {
323
318
324
319
function determineTokenService ( stt ) {
325
320
let tokenService = null ;
326
-
327
321
if ( apikey ) {
328
- // console.log('API Key stuff to go here');
329
- // tokenService = new AuthV1(stt.getCredentials());
330
- // console.log('the keys that we have are ', stt.getCredentials());
331
- // let creds = {}; // stt.getCredentials();
332
- // creds.iamApikey = apikey;
333
- // console.log('Creating token with endpoint ', endpoint);
334
- // tokenService = new AuthIAMV1.IamTokenManagerV1({iamApikey : apikey, iamUrl: endpoint});
335
-
336
- //tokenService = new AuthIAMV1({apikey : apikey});
337
- //tokenService = new AuthIAMV1.IamTokenManagerV1({iamApikey : apikey});
338
- //tokenService = new AuthIAMV1.IamTokenManager({apikey : apikey});
339
322
tokenService = new IamTokenManager ( { apikey : apikey } ) ;
340
- //tokenService = new iamutils(apikey);
341
-
342
- } //else {
343
- //tokenService = new AuthV1(stt.getCredentials());
344
- //}
345
-
346
- // Streaming - IAM Key fudge.
347
- // Check if the token service options have the header set. If not then
348
- // create them. This will stop the function from crashing the app,
349
- // altough it will still fail authentication.
350
- //if (!tokenService._options.headers) {
351
- // tokenService._options.headers = {};
352
- //}
323
+ }
353
324
return tokenService ;
354
325
}
355
326
0 commit comments