I am working on a project where I have implement authentication using API from php/laravel backend.Now I have to implement chatting feature in my app using firebase.I have seen many tutorials where everyone using google sign up option by firebase authentication but I have already implement auth and getting a user id. Is there any way to implement chatting using firebase without firebase auth?
"id": 2, "first_name": "MD Mustafizur",
CodePudding user response:
try to edit Firestore rules to allow read and write to anyone
CodePudding user response:
If you don't want to require your users to sign in, consider using Firebase's anonymous authentication provider. This gives users a unique UID without requiring them to enter any credentials, with this code:
try {
final userCredential = await FirebaseAuth.instance.signInAnonymously();
print("Signed in with temporary account.");
print("UID: ${userCredential.user.uid}");
} on FirebaseAuthException catch (e) {
switch (e.code) {
case "operation-not-allowed":
print("Anonymous auth hasn't been enabled for this project.");
break;
default:
print("Error: $e");
}
}