@@ -29,7 +29,9 @@ module.exports = function (RED) {
2929 sttutils = require ( './stt-utils' ) ,
3030 AuthV1 = require ( 'watson-developer-cloud/authorization/v1' ) ,
3131 //AuthIAMV1 = require('ibm-cloud-sdk-core/iam-token-manager/v1'),
32- { IamTokenManager } = require ( 'ibm-watson/auth' ) ;
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+ //{ IamTokenManager } = require('ibm-watson/auth');
3335 muteMode = true , discardMode = false , autoConnect = true ,
3436 username = '' , password = '' , sUsername = '' , sPassword = '' ,
3537 apikey = '' , sApikey = '' ,
@@ -326,7 +328,9 @@ module.exports = function (RED) {
326328 // console.log('Creating token with endpoint ', endpoint);
327329 // tokenService = new AuthIAMV1.IamTokenManagerV1({iamApikey : apikey, iamUrl: endpoint});
328330
329- tokenService = new IamTokenManager ( { apikey : apikey } ) ;
331+ //tokenService = new AuthIAMV1({apikey : apikey});
332+ tokenService = new AuthIAMV1 . IamTokenManagerV1 ( { iamApikey : apikey } ) ;
333+ //tokenService = new AuthIAMV1.IamTokenManager({apikey : apikey});
330334 //tokenService = new iamutils(apikey);
331335
332336 } else {
@@ -443,13 +447,11 @@ module.exports = function (RED) {
443447 tokenPending = true ;
444448 tokenService . getToken ( function ( err , res ) {
445449 if ( err ) {
446- // console.log('Error getting token ', err);
447450 reject ( err ) ;
448451 } else {
449452 tokenPending = false ;
450453 tokenTime = now ;
451454 token = res ;
452- // console.log('We have the token ', token);
453455 resolve ( ) ;
454456 }
455457 } ) ;
@@ -663,7 +665,6 @@ module.exports = function (RED) {
663665 . then ( ( ) => {
664666 switch ( audioData . action ) {
665667 case 'start' :
666- // console.log('Its a start');
667668 return processSTTSocketStart ( true ) ;
668669 case 'stop' :
669670 delay = 2000 ;
@@ -672,7 +673,6 @@ module.exports = function (RED) {
672673 // Add a Delay to allow the listening thread to kick in
673674 // Delays for Stop is longer, so that it doesn't get actioned
674675 // before the audio buffers.
675- // console.log('We have data');
676676 setTimeout ( ( ) => {
677677 if ( socketListening ) {
678678 return sendAudioSTTSocket ( audioData ) ;
0 commit comments