How to set the cookies response when calling nodejs api from laravel? - node.js

I have on linux server a running nodejs and laravel. When I try to call the nodejs api endpoint. The response is
{"errors":[{"msg":"Invalid value","param":"cookies","location":"body"}]}
This is the api call to the node
$response = $myclient->request("POST", "/api/path", ["json" => $query]);
The nodejs api is generating the cookies, but it is not readable. The project is using GuzzleHttp for handling the request on laravel. Is there a specfic method to define cookies with response?

Related

Nodejs server - how can I intercept a 3rd party request and forward it the request to a proxy (rewrite request)?

Scenario
I have nodejs app is deployed on our infrastructure at work
At some point in the login / auth process of my app, my app will make a POST request to https://login.microsoftonline.com for authenticating the user (remix-auth-microsoft library is the one making the POST request)
My POST request to login.microsoft.com fail because our servers at work are not allowed to make external calls to the internet, unless we make our requests through a proxy (lets call it: example-proxy.com)
Question
How would I intercept the HTTP POST call that the 3rd party library is making in my nodejs app and proxy that request to example.proxy.com. Essentially I want login.microsoft.com to think the POST request is coming from example-proxy.com. Then I want the proxy server to return that data to my app
Are there specific headers I need to pass to make this work?
Some pseudo code of what I'm trying to do:
someInterceptor.on(request, (request) => {
if(outgoingRequest === 'https://login.microsoftonline.com') {
// somehow re-write the request so login.microsoftonline.com thinks the POST is coming from example-proxy.com
}
})

How to make post request using SOAP in node.js

I'm using the library SOAP (https://www.npmjs.com/package/soap) to make requests to a wsdl, but I'm getting the error HTTP GET not supported, using SOAPUI or even axios with post method seems to work

Express API response directly outputted in browser instead being handled by Nuxt.js

I have an express server that is connected to mongodb. I have a nuxt route for /account under pages directory. I also have a same route in the express server app.use('/account', account) which is handling the requests.
The database model has been set correctly and the response is sent by the server using return res.status(200).json(User) whenever the route is called upon using a get request. I'm also seeing the response being delivered to the browser.
But the problem is the response is being outputted directly in the browser as raw json. Nuxt is not being loaded to handle the response. I haven't setup any $axios data call in the component using asyncdata or fetch yet.
Here's the sample response that i see in the browser
{"email":"sample#example.com","account":"123445667777"}
I'm not sure what the issue is?

How can I trigger api from node js in response to apiai query request?

I am using apiai module in node js and I am calling apiai query. I want to call my webservice from my nodejs not apiai webhook. Is there any mechanism.

Http request succeed when using postman, fails when using node.js axios

I have deployed BeaconCtrl project on heroku, it has a server to server api,
I tried requesting some routes using postman, with the same headers, body and the same route, it responds with 500 internal server error !.
does requesting from server to another server differ from requesting from postman to a server ?

Resources