Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70440

HTTP Post in iOS not working

$
0
0

@OmDIonic wrote:

HI I am trying for http post request in iOS but its not working and giving error

both angular http and ionic http not for POST request in iOS.

Error Response is

{“ngTempTokenPath”:null,“ngTokenPath”:[“HomePage”,null],“line”:44815,“column”:28,“sourceURL”:“ionic://localhost/vendor.js”}

My Post Request

const httpOptions = {
headers: new HttpHeaders({
‘Authorization’: Authorization,
‘Content-type’ : ‘application/json’,
})
};

const body = new HttpParams()
.set(‘grant_type’, ‘authorization_code’)
.set(‘client_id’ , this.client_id)
.set(‘redirect_uri’, this.redirect_url)
.set(‘code’,code);

this.http.post(this.token_url,body
,httpOptions).subscribe(
(response) => {
console.log(‘Token recived------------’+response);
},
(error) => {
console.log(‘res-----’+JSON.stringify(error));
if (error.error instanceof ErrorEvent) {
// A client-side or network error occurred. Handle it accordingly.
console.error(‘An error occurred:’, error.error.message);
} else {

    // The backend returned an unsuccessful response code.
    // The response body may contain clues as to what went wrong,
    console.error(
      `Backend returned code ${error.status}, ` +
      `body was: ${error.error}`);
  }
});

Can anybody tell my mistake.

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 70440

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>