Hi,
I am trying to write a client program to call a restfull GET with Basic
authorization but it is giving 401 error (unauthorized client).
below is piece of code i am using:
var http = require('http');
var options = {
host: 'taken.generate.url',
port: 38080,
path:
'oauth2-api/p/v1/token?scope=TMO_ID_profile%20associated_lines%20token_validation%20iam_account_lock_information%20billing_information%20permission%20offer&grant_type=client_credentials',
authorization: 'Basic VHJ1c3RlZENsaWVudENSMjQ6enJCamZ6cWdESw==',
method: 'GET'
};
http.request(options, function(res) {
console.log('STATUS: ' + res.statusCode);
console.log('HEADERS: ' + JSON.stringify(res.headers));
res.setEncoding('utf8');
res.on('data', function (chunk) {
console.log('BODY: ' + chunk);
});
}).end();
-------------------------------
when i am using shell script ,I am able to achieve this with success 200.
$ curl -i -H 'Authorization: Basic
VHJ1c3RlZENsaWVudENSMjQ6enJCamZ6cWdESw==' -H 'Content-Type:
application/x-www-form-urlencoded' -H 'Accept: application/json' -X GET
'http://<IPADRRESS>:38080/oauth2-api/p/v1/token?scope=TMO_ID_profile%20associated_lines%20token_validation%20iam_account_lock_information%20billing_information%20permission%20offer&grant_type=client_credentials'
Please suggest where I am doing mistake in node.js file.
Thanks
--
Job board: http://jobs.nodejs.org/
New group rules:
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules:
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
---
You received this message because you are subscribed to the Google Groups
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/nodejs/4062696f-1b26-4c17-b6bc-559826f13031%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.