I am attempting to get my React Native application working on a real iPhone so I can begin integrating the app with branch.io. For some reason I cannot get my app to make network requests to my backend api on AWS. My code works as expected in the simulator when I hit the backend api on my local dev environment with localhost:3000/auth/login/. Below are the results of my efforts.
HTTP Class Post Method:
post(endpoint, body, auth = null) {
console.log(this.apiUrl + endpoint);
console.log(this._headers(true));
console.log(body);
return Observable.defer(() => {
return Observable.fromPromise(fetch(this.apiUrl + endpoint, {
method: 'post',
headers: this._headers(auth),
body: JSON.stringify(body)
})
.then(this._checkStatus)
.then(res => res.json()));
});
}
_headers(auth) {
let token = (auth) ? token = Config.clientId : this.accessToken;
let headers = new Headers({
'Content-Type': 'application/json',
'Authorization': 'Bearer ' + token
});
return headers;
}
After building the code to my iOS device I attempt to login and nothing happens. I added console calls to my post request to make sure the proper values are being passed and that seems to be correct. Below is the results of what I see when I attempt to login while running debug mode. I am new to React Native so I am not sure if the network tab would detect requests coming from a real device, nonetheless there is no sign of any network call being made.
Running the same exact call from Postman works as expected and can be seen below:
Any assistance would be greatly appreciated. Thanks you in advance.