I am writing a pre-request script in postman to execute. The code looks like below
var settings={
"url":environment.url+"/fullendpoint",
"method":"post",
"data":"{'Username':'username','Password':'password'}",
"Content-Type":"application/json",
};
$.ajax(settings).done(function (response){
console.log(response)
});
Executing above, I am getting error as "Response to preflight request doesn't pass access control check:
No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access. The response had HTTP status code 405.
Above method is basically to login the user to the application and capture the response cookies and headers so that it can be used for the actual api call.