Is this possible to send session ID in header via post request
Here is my code in express JS :
app.use(session({
secret: 'newsession',
saveUninitialized:false,
resave:false,
cookie: {
secure: false,
httpOnly:false,
}}));
app.post ('/login', function (request, response, next) {
const { username , password } = request.body
db.find(db.COLLECTIONS.USERS,{username: username, password: password}).then((users) => {
if (users.length !== 0) {
request.session.isAuth=true;
response.status(200).json(users[0]);
} else {
response.status(409).send("Username not found");
}
}).catch(() => {
response.status(409).send();
});
});
now when I am going send post request in postman using JSON type for example:
{
"username":"user",
"password":"user"
}
I want to know is it possible to send session id in header to client from server ?