Ionic2: Http sends {"isTrusted":true} - Conflict with other observables?
<p>I try to develop my new app with Ionic2. In this context, the user should be authenticated with a pre shared token which will be sent to the api (http request). As a response he get an access token with which he can use further api functions. </p>

<p>The problem is that when I send an HTTP request, I get as an error: 
{"_body":{"isTrusted":true},"status":200,"statusText":"Ok","headers":{},"type":3,"url":null}</p>

<p>In my desktop version everything works fine, but on Android I get this error. I still googled this error and I guess that the http request comes in conflict with other observables (Form observable). </p>

<p>I would be very pleased if someone could help me to avoid this "error". 
As a small hint: {"isTrusted":true} is the value of the event value of the method handleSubmit. Thank you :-)</p>

<p>Solution: 
This error was thrown because the api was not reachable (in my case due to a certificate error). When you have the same error: 
Check if type="3", then it is possible that your http target is also not reachable. </p>

<p>My template: </p>

<pre><code>&lt;ion-content padding class="token-auth"&gt;
  &lt;form [ngFormModel]="authForm" (submit)="handleSubmit($event)"&gt;
    &lt;ion-item&gt;
      &lt;ion-label floating&gt;Device-ID&lt;/ion-label&gt;
      &lt;ion-input (keyup)="onKeyUp($event)" [ngFormControl]="token" type="text"&gt;&lt;/ion-input&gt;
    &lt;/ion-item&gt;

    &lt;div *ngIf="error !== null"
         class="error-box"&gt;
      {{error.message}}
    &lt;/div&gt;

    &lt;button block type="submit" [disabled]="!authForm.valid"&gt;
      Register device
    &lt;/button&gt;

  &lt;/form&gt;
&lt;/ion-content&gt;
</code></pre>

<p>Page source: </p>

<pre><code>handleSubmit(event) : void {          
  this.tokenService.sendAccessTokenRequest(this.authForm.value.token, (err, code) =&gt; {
        this.error = {
            code : code,
            message : err
        };
    }, (accessToken, refreshToken, validTill) =&gt; {
        this.error = null;
    });
}
</code></pre>

<p>TokenService: </p>

<pre><code>/**
 *
 * @param token
 * @param errCallback : (message : string, code : number) =&gt; any
 * @param callback : (accessToken : string, refreshToken : string, validTill : string) =&gt; any
 */
public sendAccessTokenRequest(token : string, errCallback, callback) {
    if (typeof token === 'undefined') {
        throw 'Token value must be set. ';
    }
    if (typeof errCallback === 'undefined') {
        errCallback = (code, message) =&gt; null;
    }
    if (typeof callback === 'undefined') {
        callback = (accessToken, refreshToken, validTill) =&gt; null;
    }

    console.log(`Should send token: ${token}`);

    this.sendPost(`/auth/login`, `application=XXX&amp;device_token=${token}`)
        .subscribe(res =&gt; {
            console.log("Device verified: "+JSON.stringify(res));
            let {
                access_token,
                refresh_token,
                valid_till
            } = res.data.token;
            this._saveTokenData(access_token, refresh_token, new Date(valid_till));
            callback(access_token, refresh_token, valid_till);
        },
        err =&gt; {
            // error is here!
            if (err &amp;&amp; err._body) {
                console.log("ERROR: "+JSON.stringify(err));
                try {
                    let bodyData = JSON.parse(err._body);
                    let responseData = bodyData["data"];
                    let token:MessageResponse = responseData.token;
                    if (token &amp;&amp; typeof token.code !== 'undefined' &amp;&amp; typeof token.userMessage !== 'undefined') {
                        errCallback(token.userMessage, token.code);
                    } else {
                        errCallback(bodyData);
                    }
                } catch (e) {
                    errCallback(e);
                }
            }
        },
        () =&gt; console.log("access token request successful")
    );
}

// just an excerpt from other url
sendPost(link : string, params : string, header : Object = {}) {
    console.log("SEND POST");
    link = this._enforceSlashAtStringStart(link);
    return this.http.post(`${this.base_url}${link}`, params, {
        headers : this._mergeHeader(this.getHeader(), header)
    }).map(res =&gt; { console.log("Start mapping! "); return res.json(); });
}

// EDIT: added function _saveTokenData
private _saveTokenData(accessToken : string, refreshToken : string, validTill : Date) {
        if (!accessToken || !refreshToken || !validTill) {
            throw new Error('access token data can not be null or undefined! ');
        }

        console.log("TOKEN SAVED!");

        this._accessToken = accessToken;
        this._refreshToken = refreshToken;
        this._validTill = validTill;

        // this._storage = new Storage(LocalStorage);
        this._storage.set(TOKEN_STORAGE_KEY, JSON.stringify({
            access_token : accessToken,
            refresh_token : refreshToken,
            valid_till : validTill.toString()
        }));
    }
</code></pre>

<p>And last but not least the logs: </p>

<pre><code>14    256534   log      Should send token: XXXXXXXXXXXXXX
15    256548   log      SEND POST
16    256750   log      ERROR: {"_body":{"isTrusted":true},"status":200,"statusText":"Ok","headers":{},"type":3,"url":null}
</code></pre>