ERROR: Login request is missing required email

Hello,

I am trying to Login using POSTMAN Client for Chrome browser and using AJAX from a JS script, i am getting the Login request is missing required email error. But Login works when i use the JS SDK.

Screenshot of POSTMAN Client:

If you are sending XML, see here:

I am using plain ajax request, can you please provide an example of using with the POSTMAN client for chrome or advise me if there is any error with the attached image.

Thank you.

If you post the complete request and response, headers and body, I can tell you what is wrong.

https://dl.dropboxusercontent.com/s/fap7jijjwin6twk/post.PNG?dl=0

This image has the complete header and body.

That image is a screenshot from a utility. Could you provide the raw POST and response? (Your browser’s network/console view should trap the full, actual request and response.)

[Removed incorrect statement, see post below for further detail.]

Sorry, please check the complete details below,

Remote Address:127.0.0.1:80
Request URL:http://localhost/rest/user/session?email=example@example.com&password=12345
Request Method:POST
Status Code:400 Bad Request
Request Headersview source
Accept:/
Accept-Encoding:gzip, deflate
Accept-Language:en-US,en;q=0.8,ta;q=0.6
Cache-Control:no-cache
Connection:keep-alive
Content-Length:0
Cookie:keystone.sid=s%3A688vaYdgAv7cSxSFNgdqBABv.%2F7hFPV1NvyAm8c1G1hR8mLBsfBxOMKOoxMKY%2BYbm018; XSRF-TOKEN=qOy5AWrdogKZ2K5hlVVGypCfWEl4ayXg%2FazFQ%3D; PHPSESSID=mmk5vc27gp5np4kb8eesbog4d3; sails.sid=s%3AfRNA55n0iDbpNSEtCNq6fPGi.oa%2F3Tr7y4sS10f2fcMjNaakuqm3t94djcpa1Kckxi0k
Host:localhost
Origin:chrome-extension://fdmmgilgnpjigdojojpjoooidkmcomcm
User-Agent:Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36
X-DreamFactory-Application-Name:example
Query String Parametersview sourceview URL encoded
email:example@example.com
password:12345
Response Headersview source
Access-Control-Allow-Credentials:true
Access-Control-Allow-Headers:Content-Type,X-Requested-With,X-DreamFactory-Application-Name,X-Application-Name,X-DreamFactory-Session-Token,X-HTTP-Method,X-HTTP-Method-Override,X-METHOD-OVERRIDE
Access-Control-Allow-Methods:GET, POST, PUT, PATCH, MERGE, DELETE, OPTIONS
Access-Control-Allow-Origin:*
Access-Control-Max-Age:900
Cache-Control:no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Connection:close
Content-Length:92
Content-Type:application/json; charset=utf-8
Date:Mon, 29 Dec 2014 17:47:03 GMT
Expires:Thu, 19 Nov 1981 08:52:00 GMT
P3P:CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"
Pragma:no-cache
Server:Apache
X-DreamFactory-Origin-Whitelisted:0
X-DreamFactory-Source:http://localhost
X-Frame-Options:SAMEORIGIN
X-Powered-By:PHP/5.4.35

It looks to me like you’re providing email and password as both header values and URI parameters. Have you tried just using one or the other?

I am passing the application name via Header and email, password via URL Params… I am really not sure what is the issue, CORS is also enabled for all requests and hosts (*)

I was incorrect when I stated I got the curl request to work using URI parameters to provide email and password. This does not work and the response I received was due to having guest access enabled, not actually instantiating a valid session for the given user.

Credentials (email, password) must be provided as part of the body of the request, not in the URI. E.g., in JSON,

{ "email": "jeffrey@dreamfactory.com", "password": "12345" }

I installed Postman and tested with the above, and it worked. No URI parameters involved.

Wiki page for reference on including email and password in body instead of URI:

https://github.com/dreamfactorysoftware/dsp-core/wiki/User-Profile-Management

Awesome! Thank you! :smile:

1 Like