Rest call fails from android but works from browser


#1

I have set up a public custom script service. I followed the tutorial from http://wiki.dreamfactory.com/DreamFactory/Tutorials/Setting_up_guest_access .

If I use https://addons.mozilla.org/en-US/firefox/addon/restclient/ and simulate a post request to http://192.168.56.1:8080/api/v2/auth_confirm which is my localhost everything works. I get back a script error response :
{
“error”:
{
“context”: null,
“message”: “Undefined index: loginType”,
“code”: 500,

The same call(post, with header containing X-DreamFactory-Api-Key which I checked 20 times made from android (Everything else on the app that needs a session token from android works ok) fails :

POST /api/v2/auth_confirm HTTP/1.1

Accept application/json
X-DreamFactory-Api-Key 1dcc1606f2cd2b84c6a5132be3d3e74cffcce0603157f92c41xxx
Content-Type application/json
Content-Length 250
User-Agent Dalvik/2.1.0 (Linux; U; Android 5.1; Google Nexus 5 - 5.1.0 - API 22 - 1080x1920 Build/LMY47D)
Host 192.168.56.1:8080
Connection Keep-Alive
Accept-Encoding gzip

{
“error”: {
“context”: null,
“message”: “Invalid token: Wrong number of segments”,
“code”: 401,


#2

Well there seems to be a problem in the following param :

The browser rest call sends in the header : Content-type : text/html
The android sends : Content-type : application/json; charset=UTF-8

The public rest service doesn’t work with content-type : application/json but the rest endpoints like user/session work and the ones that need X-DreamFactory-Session-Token work with this content-type

Can someone confirm or explain please ?

@aislam @toddappleton

Thank you.