NodeJS Consume Oauth Get API Call
NickName:ShaMoh Ask DateTime:2016-06-07T19:29:36

NodeJS Consume Oauth Get API Call

I am trying to consume data from OAuth Enabled get API call in NodeJS. I need to pass two Online-Magazine-Subscription-Key and access token. I used 'request' module to consume API call.

var accessToken = 'Bearer xxx...xxx';

request.get({
    url: URL,
    headers: { 'accept': 'application/json', 'Online-Magazine-Subscription-Key': 'x..xxx', 'Authorization': accessToken}
}, function (err, res) {
    console.log(err);
    console.log(res);
});

Its throwing error as "{ [Error: tunneling socket could not be established, cause=Parse Error] code: 'E CONNRESET' }". But the same API call is working fine in Rest Client and all other similar stuff.

Response is always undefined. Did I missed any thing in the above code?? Is there any other way to consume OAuth Enabled API Calls??

Copyright Notice:Content Author:「ShaMoh」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/37678155/nodejs-consume-oauth-get-api-call

More about “NodeJS Consume Oauth Get API Call” related questions

NodeJS Consume Oauth Get API Call

I am trying to consume data from OAuth Enabled get API call in NodeJS. I need to pass two Online-Magazine-Subscription-Key and access token. I used 'request' module to consume API call. var access...

Show Detail

OAuth flow testing in NodeJS using Mocha

I'm trying to create and app that uses reddit's OAuth flow to authenticate the user and retrieve an access token that will be used by my app for further reddit api calls. When they consume the ap...

Show Detail

call OAUTH2 api in python script

i have found this interesting article here https://developer.byu.edu/docs/consume-api/use-api/oauth-20/oauth-20-python-sample-code in this article there is an example how to call an oauth2 api using

Show Detail

API Call with NodeJS signing with Oauth1 not working

I have a problem with my api call using NodeJS. I have no problem with postman, but when I run it with Node, server response is 401. Here's the nodejs code: var request = require("request"); var

Show Detail

Nodejs Express Web APP - Consume API - Token

I'm new with nodejs and i have a situation. I have a WebApp with nodejs, express and EJS templates and I consume an external API. I have to impletate the login and I dont know how handle the TOKE...

Show Detail

Ansible Tower API call using OAuth2 Token from Nodejs App

Can we call Ansible Tower Api by passing only Oauth2 token no username or password? (Say I want to fetch my inventories from ansible tower by passing only Oauth2 token to my nodejs script. Is that

Show Detail

Consume Workday REST API with oAuth 2.0 in .NET MVC

I am trying to call the Workday REST API in my .NET MVC application and am having trouble with the oAuth 2.0 aspect of it. Although in my case I am talking about Workday in particular, I think what...

Show Detail

REST API oauth2 type authentication using AWS Cognito

I have a rest api in nodejs. my mobile app will consume my rest api. Can i implement oauth2 type authentication using aws cognito for my mobile app? I need resource owner password grant if i implem...

Show Detail

Securing a nodejs / sailsjs API with OAuth2

I have developed a REST API with sailsjs and I'd like to add OAuth2 authorization to secure this API. I'm quite new to OAuth and I'm not sure where to start. I found several modules that could be ...

Show Detail

Consume a third-party API protected with Oauth2 in Django

I am trying to access a third-party API with my Django app to post some information to that API. This API supports OAuth2 authentication only and I am trying to build a Oauth2 client of consume an

Show Detail