> On Jun 2, 2015, at 2:36 AM, Rajeev Kumar <[email protected]> wrote:
> 
> 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'
> };

authorization is not an option to the http library, but a header you send. Try

headers: {
    Authorization:  'Basic VHJ1c3RlZENsaWVudENSMjQ6enJCamZ6cWdESw=='
},

in the options.

Also, please note that those credentials should have been throw-away ones. 
Decoded they are TrustedClientCR24:zrBjfzqgDK. You'll need to replace those 
credentials since they're compromised.

Aria

-- 
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/D22C732E-3652-48A3-86E8-A03231AE4602%40dinhe.net.
For more options, visit https://groups.google.com/d/optout.

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to