I have a problem with the connection of an application, it is created with react native, the laptop is an AMD with windows 10, and the mobile phone has an Android system.
I give you the error.
What happens is that every time I login, it is either empty, or I have a username and password (which is already registered in the database).
this happens
How do you get to this?, we go by steps:
1º- I connect the device via USB (both the USB and the cable are in good condition, it has already been checked, that's not why).
Run adb devices command in terminal, you can see the device is connected.
2º- The yarn android command is executed, it begins to execute and the application is installed on the device.
When executing the command, it is installed on the device.
Successful installation of the App on the physical device.
So far so good, but now comes the problem : You want to check if there is a connection, so what you want is to see how it responds with a user who is registered and making an empty login, and see how the application responds.
I pass you the login function, so you can see the code
_loginAsync = async () => {
// reinit error states
this.setState({emailError: '', passwordError: '', errorMessage: ''});
console.log('start login');
//FIXME: ONLY FOR LOCAL DEVELOPMENT SETTING LOGIN OFF
//this.props.navigation.navigate('App');
try {
auth
.authenticate(this.state.email, this.state.password)
.then(response => {
console.log('auth response: ' + JSON.stringify(response));
if (response.error) {
if (typeof response.error === 'object') {
Object.keys(response.error).forEach(type => {
this.setState({[type + 'Error']: response.error[type]});
});
} else {
this.setState({errorMessage: response.message});
}
} else {
//FIXME: ONLY FOR LOCAL DEVELOPMENT SETTING LOGIN OFF
this.props.navigation.navigate('App');
}
})
.catch(exception => {
console.log('auth exception: ' + exception);
});
} catch (error) {
console.log('auth error: ' + error);
}
};
Attached image of the physical device inspector
here I add the index.js
<script src="https://gist.github.com/MMBBAA/6ca2eab4115d287d9949a34b6fbc6f5d.js"></script>
FIXED: it has been fixed in this way:
1st-delete this file android\app\build\intermediates\signing_config\debug\out
2º-Attached the loginPage code that works with this:
try {
}
catch (error) { console.log('auth error: ' + error); }