signInAnonymously
Molnfront opened this issue · 1 comments
Is your feature request related to a problem? Please describe.
Yes, I going to have an app with public facing list and drill down to items before they have to login or sign up, and it looks as if its extremely difficult to get the rules right in Firestore to make it work in the app. So one solution could be to allow anonymous users which then can get converted to real users.
People that wants to try an app the first time should not face a login sign.
Describe the solution you'd like
Implement signInAnonymously
When a signed-out user uses an app feature that requires authentication with Firebase, sign in the user anonymously.
Describe alternatives you've considered
Go down the rabbit hole and make tables read only for non logged in users and read, write, update for authenticated users.
Additional context
Code example:
´´´
import { getAuth, signInAnonymously } from "firebase/auth";
const auth = getAuth();
signInAnonymously(auth)
.then(() => {
// Signed in..
})
.catch((error) => {
const errorCode = error.code;
const errorMessage = error.message;
// ...
});
´´´
Don't know if it's the right way to go... By the way I am using Reactfire in the project.
Ok, no need anymore for this, solved it with firestore rules and the redirect auth route.