"Login request is missing required email" Error with a angular-dreamfactory SDK

Hi to everyone,

I am very new with DreamFactory and i liked too much

I want to work with a Angularjs Application and Angular-DreamFactory Service.

In my Controller , I called the Method

DreamFactory.api.user.login({
“email”: “MY_EMAIL”,
“password”: “MY_PASS”
},
function(data) {
console.log(‘success’);
console.log(data);
},
function(error) {
console.log(‘error’);
console.log(error);
});

And i Got the following message.

{“error”:[{“context”:null,“message”:“Login request is missing required email.”,“code”:400}]}

In my DSP Server i got CORS access to all host (*) and All Roles Configured for the AngularToDoApp.

In my AngularClientAPP the DSP_URL and DSP_API_KEY are declared with success.

It is appropriate to tell, with this command works Fine…

curl -k -3 -X POST http://ec2-XXXX.compute-1.amazonaws.com:80/rest/user/session
-H “X-DreamFactory-Application-Name: todojquery”
-d ‘{“email”: “MY_EMAIL”, “password” : “MY_PASS”}’

Please Help…

In your curl call you have quotes around the object. It’s stringified. Try that with your angular login method. Or get rid of the quotes around “email” and “password”.

Jason

Thank You so much for your answer.

I tried your option, but without success. : (

Digging in the angular-dreamfactory.js file i found the following method :

DreamFactory.api.help();

That method It showed to me all the parameters and API calls …

Looking the Login Section we see:

“body (required) - Data containing name-value pairs used for logging into the system”.

The answer was the following :

var creds = {
body: {
email: ‘MY_EMAIL’,
password: ‘MY_PASSWORD’
}
};

Then the final call is:

DreamFactory.api.user.login(creds,…);

It works fine!!!

Thanks Again!

p.d.

The example documentation from the github it is wrong… i got the first example from here:


// model for login credentials
$scope.creds = {
email: ‘’,
password: ‘’
}

// Login function
$scope.loginFunc = function() {

// Call to the DreamFactory user service using provided login method
DreamFactory.api.user.login($scope.creds,

  // Success function
  function(data) {

    // Handle login success
  },

1 Like

Ha. That’s where I looked to get an answer. I’ll get that updated. Thanks.

Thank you very much Polgarmx, I spent long hours trying to realise what you discover, it help me lots.

1 Like