# Rest call fails from android but works from browser

**URL:** <https://community.dreamfactory.com/t/rest-call-fails-from-android-but-works-from-browser/2317>\
**Category:** Authentication & Security\
**Created:** [March 4, 2016, 2:58pm UTC](https://community.dreamfactory.com/t/rest-call-fails-from-android-but-works-from-browser/2317 "2016-03-04T14:58:35Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![nvasilescu](https://avatars.discourse-cdn.com/v4/letter/n/e480ec/32.png) [@nvasilescu](https://community.dreamfactory.com/u/nvasilescu)\
**Post date:** [March 4, 2016, 2:58pm UTC](https://community.dreamfactory.com/t/rest-call-fails-from-android-but-works-from-browser/2317/1 "2016-03-04T14:58:35Z")

</div>

I have set up a public custom script service. I followed the tutorial from [https://wiki.dreamfactory.com/DreamFactory/Tutorials/Setting\_up\_guest\_access](https://wiki.dreamfactory.com/DreamFactory/Tutorials/Setting_up_guest_access) .

If I use [https://addons.mozilla.org/en-US/firefox/addon/restclient/](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](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,

---

<div class="post-metadata">

**Author:** ![nvasilescu](https://avatars.discourse-cdn.com/v4/letter/n/e480ec/32.png) [@nvasilescu](https://community.dreamfactory.com/u/nvasilescu)\
**Post date:** [March 4, 2016, 3:53pm UTC](https://community.dreamfactory.com/t/rest-call-fails-from-android-but-works-from-browser/2317/2 "2016-03-04T15:53:40Z")

</div>

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.
