I am using an authentication API from a 3rd party to help authenticate users on the web app we're building. I'm having an issue with cookies returning without a domain parameter.
I'm following a Postman collection that was provided. The response returns a couple of cookies with the domain parameter correctly listed: enter image description here
However, when I copy the code from Postman for Node.js - Request, I receive cookies, but the domain parameter is empty. This makes the cookies unaccessible to use in the follow-up call, because they are HttpOnly.
Here is the cookie response from chrome inspector - Network:
Here is the code that I added to our MERN app:
getFlow = (callback) => {
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://auth.pingone.com/XXX/as/authorize',
'headers': {
'Content-Type': 'application/x-www-form-urlencoded',
'User-Agent': 'LII-Cello/1.0 libwww/2.5',
'Cookie': 'ST=XXX',
'accept-encoding': 'gzip, deflate, br',
'content-length': '180'
},
form: {
'response_type': 'token',
'client_id': 'XXX',
'redirect_uri': 'XXX',
'scope': 'openid profile p1:read:user'
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
let flowId = response._fetchResponse.url.split('flowId=')[1];
});
Why does the request not return cookies with domain, but does return correctly in Postman?