function onAuthStateChanged(user) {
if (user) {
// Some Android devices can automatically process the verification code (OTP) message, and the user would NOT need to enter the code.
// Actually, if he/she tries to enter it, he/she will get an error message because the code was already used in the background.
// In this function, make sure you hide the component(s) for entering the code and/or navigate away from this screen.
// It is also recommended to display a message to the user informing him/her that he/she has successfully logged in.
}
}
useEffect(() => {
const subscriber = auth().onAuthStateChanged(onAuthStateChanged);
return subscriber; // unsubscribe on unmount
}, []);
function onAuthStateChanged(user) {
if (user) {
// Some Android devices can automatically process the verification code (OTP) message, and the user would NOT need to enter the code.
// Actually, if he/she tries to enter it, he/she will get an error message because the code was already used in the background.
// In this function, make sure you hide the component(s) for entering the code and/or navigate away from this screen.
// It is also recommended to display a message to the user informing him/her that he/she has successfully logged in.
}
}
useEffect(() => {
const subscriber = auth().onAuthStateChanged(onAuthStateChanged);
return subscriber; // unsubscribe on unmount
}, []);