@scmathew wrote:
login: function(email, password, callback) { alert("In login function"); $.ajax({ dataType: 'json', contentType: 'application/json; charset=utf-8', url: INSTANCE_URL + '/api/v2/user/session', crossDomain: true, //Added this for CORS (Doesn't work) data: JSON.stringify({ "email": email, "password": password }), cache:false, method:'POST', headers: { "X-DreamFactory-API-Key": APP_API_KEY //"X-DreamFactory-Session-Token": token }, success:function (response) { callback(response); }, error:function (response) { callback(response); return false; } });
I am trying to log users in using this post accessing the api docs on my DreamFactory instance. When I try it locally it works fine, but when I switch over to an official instance I get blocked by a preflight request and get the following error:
XMLHttpRequest cannot load http://52.87.25.0/api/v2/user/session. Response to preflight request doesn't pass access control check: The 'Access-Control-Allow-Origin' header contains multiple values 'http://23.42.248.110, *', but only one is allowed. Origin 'http://23.42.248.110' is therefore not allowed access.
I am using Node.js and I have tried to set the response header and the npm cors package, but neither of those have seemed to make a difference.
Posts: 1
Participants: 1