Skip to content

Commit

Permalink
updated ASR server
Browse files Browse the repository at this point in the history
  • Loading branch information
tbass134 committed Oct 24, 2017
1 parent 376cea5 commit 8f33a21
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion WS-node/lib/asrClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ const url = require('url')
var socket;

function getBearerToken (asrUrl, clientKey, clientSecret, callback) {
console.log('getBearerToken using', asrUrl);

request({
url: asrUrl+'/api/oauth2/token',
url: url.resolve(asrUrl, '/oauth2/token'),
method: 'POST',
json: true,
headers: { 'content-type': 'application/json' },
Expand All @@ -18,9 +20,12 @@ function getBearerToken (asrUrl, clientKey, clientSecret, callback) {
body: { 'grant_type': 'client_credentials' }
}, (err, res, body) => {
if (err) {
console.log('getBearerToken Err',err )
return callback(new Error('Authentication to API error:' + err))
}
if (res.statusCode !== 200) {
console.log('getBearerToken Err',err )
console.log('getBearerToken body ', body)
return callback(new Error('Authentication to API got error code: ' +
res.statusCode))
}
Expand Down

0 comments on commit 8f33a21

Please sign in to comment.