Please provide the following:
- SDK Version: “expo”: “~38.0.8”,
- Platforms(Android/iOS/web/all): Android - iOS
code:
userLogin = () => {
const {username, password} = this.state;
const url = 'http://localhost:8080';
const credentials = 'angularapp'+ ':' + '12345'
fetch( url + '/oauth/token', {
method: 'POST',
headers: { 'Accept': '*/*', 'Content-Type': 'application/x-www-form-urlencoded', 'Authorization': 'Basic' + credentials },
body: JSON.stringify({
grant_type: 'password',
username: username,
password: password
})
}) .then((response) => response.json())
.then((responseData) => {
console.log("response: " + responseData);
this.navigation.navigate('TabViwew')
})
.catch((err) => { console.log(err);
});
}
error:
Network request failed
- node_modules\whatwg-fetch\dist\fetch.umd.js:527:17 in setTimeout$argument_0
- node_modules\react-native\Libraries\Core\Timers\JSTimers.js:135:14 in _callTimer
- node_modules\react-native\Libraries\Core\Timers\JSTimers.js:387:16 in callTimers
- node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:425:19 in __callFunction
- node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:112:6 in __guard$argument_0
- node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:373:10 in __guard
- node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:111:4 in callFunctionReturnFlushedQueue
- [native code]:null in callFunctionReturnFlushedQueue