Use the recommended code snippet for the auth signing in page. (I use GoRoute so the code is a bit different, but everything around firebase_ui_auth is the same)
Then in the Sign In page, click "Register", fill in valid credential and click the "Register" button.
Expected Behavior
At least something will happen to indicate that the registration is successful. Either jumping to the email verification page, or the sign in page, or some hint appears.
If nothing happens, the documentation should highlight this intended design, and add post-registration handling in the example code snippet.
Actual Behavior
Nothing happens after successfully adding the user data to the firebase auth database.
The firebase_ui_auth documentation does not clarify this intended(?) behavior, or tell developers how to customize the post-registration behavior.
Additional Information
I post this issue as a "bug" because the documentation says nothing about this phenomenon. So I doubt whether it is really intended that nothing happens after users click the Register button.
Some suggested solutions are:
After I looked deeply into the source code, I found that the AuthState SigningUp is issued before trying to write the user credential in the database, and UserCreated is issued after successfully written the user credential in the database. So below is my solution, and I suggest the example code snippet in the library documentation also change to similar (except for the use of GoRoute)
GoRoute(
path: '/sign-in',
builder: (BuildContext context, GoRouterState state) {
return SignInScreen(
actions: [
/// SignedIn state happens after a successful signing-in
AuthStateChangeAction<SignedIn>((context, signInState) {
debugPrint("AuthState changed: ${signInState.user!.email}");
if (signInState.user!.emailVerified) {
context.pushReplacement(HomeScreen.route);
} else {
context.push('/verify-email');
}
}),
/// UserCreated state happens after a successful signing-up
AuthStateChangeAction<UserCreated>((context, state) {
scaffoldMessengerKey.currentState?.showSnackBar(
const SnackBar(content: Text("User created. Please sign in now."))
);
context.push("/verify-email");
}),
],
);
},
),
I'd suggest the library developers to (optionally) automatically send an email verification after a successful registration. The option may be provided in the constructor of SignInScreen. Moreover, if app developers decided to not verify emails, there can be another option to automatically sign in after a successful registration.
Although I haven't tried RegisterScreen yet, it sounds like something similar to SignInScreen. I don't know why are there two ways to provide email registration UI, and why we can't customize the "authSwith" (Register/Sign In text button) on the SignInScreen to use dedicated pages instead.
Is there an existing issue for this?
What plugin is this bug for?
Firebase UI Auth
What platform(s) does this bug affect?
Android, iOS
List of dependencies used.
flutter pub deps -s list
Steps to reproduce
Use the recommended code snippet for the auth signing in page. (I use
GoRoute
so the code is a bit different, but everything aroundfirebase_ui_auth
is the same)Then in the Sign In page, click "Register", fill in valid credential and click the "Register" button.
Expected Behavior
At least something will happen to indicate that the registration is successful. Either jumping to the email verification page, or the sign in page, or some hint appears.
If nothing happens, the documentation should highlight this intended design, and add post-registration handling in the example code snippet.
Actual Behavior
firebase_ui_auth
documentation does not clarify this intended(?) behavior, or tell developers how to customize the post-registration behavior.Additional Information
I post this issue as a "bug" because the documentation says nothing about this phenomenon. So I doubt whether it is really intended that nothing happens after users click the Register button.
Some suggested solutions are:
SigningUp
is issued before trying to write the user credential in the database, andUserCreated
is issued after successfully written the user credential in the database. So below is my solution, and I suggest the example code snippet in the library documentation also change to similar (except for the use ofGoRoute
)SignInScreen
. Moreover, if app developers decided to not verify emails, there can be another option to automatically sign in after a successful registration.RegisterScreen
yet, it sounds like something similar toSignInScreen
. I don't know why are there two ways to provide email registration UI, and why we can't customize the "authSwith" (Register/Sign In text button) on theSignInScreen
to use dedicated pages instead.