I am using React native. I want to prevent logging in with a specific UID among UIDs that have anonymous login in my app.
However, Even if I try to disable anonymous login in the firebase console, it keeps logging in.
i tried like this
However, if I keep running the app, i can still be logged in. What should I do?
this is my code
import auth from '@react-native-firebase/auth';
useEffect(() => {
auth()
.signInAnonymously()
.then(() => {
console.log('User signed in anonymously');
})
.catch(error => {
if (error.code === 'auth/operation-not-allowed') {
console.log('Enable anonymous in your firebase console.');
}
console.log("error:", error);
console.error(error);
});
}, []);
function onAuthStateChanged(user) {
setUser(user);
if (initializing) setInitializing(false);
}
useEffect(() => {
const subscriber = auth().onAuthStateChanged(onAuthStateChanged);
return subscriber; // unsubscribe on unmount
}, []);
