Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[firebase_ui_auth] Emit SignedIn event after UserCreated #382

Closed
1 task done
Rexios80 opened this issue Aug 20, 2024 · 5 comments · Fixed by #422
Closed
1 task done

[firebase_ui_auth] Emit SignedIn event after UserCreated #382

Rexios80 opened this issue Aug 20, 2024 · 5 comments · Fixed by #422
Labels
auth blocked: customer response Waiting for customer response, e.g. more information was requested. Needs Attention OP created or responded to issue and it needs attention. platform: all

Comments

@Rexios80
Copy link
Contributor

Is there an existing issue for this?

  • I have searched the existing issues and found no duplicates.

What plugin is this bug for?

Firebase UI Auth

What platform(s) does this bug affect?

No response

List of dependencies used.

Not relevant

Steps to reproduce

  • Register a new user
  • SignedIn event is not sent

Expected Behavior

SignedIn event is sent after UserCreated event

Actual Behavior

SignedIn event is not sent after UserCreated event

Additional Information

No response

@Rexios80
Copy link
Contributor Author

Not exactly sure if we want this behavior or not, but if this is intended it needs better documentation

@russellwheatley
Copy link
Member

@Rexios80 - Please provide a code sample for me to drop in to example app so I know specifically what you're referring to. Thanks.

@russellwheatley russellwheatley added auth blocked: customer response Waiting for customer response, e.g. more information was requested. labels Sep 4, 2024
@Rexios80
Copy link
Contributor Author

Rexios80 commented Sep 4, 2024

@russellwheatley The example code in the readme has this issue: https://pub.dev/packages/firebase_ui_auth

Using that code, the app does not go to the signed in page after registering a new user because there is no handler for the UserCreated event

@jsenitza
Copy link

I'm running into this as well - my newState goes from SigningIn to UserCreated and then never throws the SignedIn status. I'm assuming I'm safe to stop at UserCreated but this tripped me up as well as the documentation that @Rexios80 posted is what I was following, waiting for the status to hit SignedIn.

AuthStateListener<OAuthController>(
                child: OAuthProviderButton(
                    provider: GoogleProvider(
                        clientId:
                            'OMITTED.apps.googleusercontent.com')),
                listener: (oldState, newState, ctrl) {
                  dPrint('Old state: $oldState, New state: $newState');
                  if (newState is SigningIn) {
                    dPrint('Signing in...');
                  } else if (newState is UserCreated) {
                    dPrint('User created...');
                  } else if (newState is SignedIn) {
                    dPrint('Signed in with Google');
                    if (context.mounted) {
                      dPrint('Navigating to finish profile page');
                      Navigator.pushReplacement(
                        context,
                        MaterialPageRoute(
                          builder: (context) => const OauthFinishProfilePage(),
                        ),
                      );
                    }
                  } else if (newState is AuthFailed) {
                    dPrint('Authentication failed: ${newState.exception}');
                  }
                  return null;
                },
              ),

Here's what this outputs when I login using Google:

flutter: Old state: Instance of 'Uninitialized', New state: Instance of 'SigningIn'
flutter: Signing in...
flutter: Old state: Instance of 'SigningIn', New state: Instance of 'UserCreated'
flutter: User created...

@russellwheatley russellwheatley added Needs Attention OP created or responded to issue and it needs attention. and removed blocked: customer response Waiting for customer response, e.g. more information was requested. labels Sep 17, 2024
@russellwheatley russellwheatley added blocked: customer response Waiting for customer response, e.g. more information was requested. platform: all and removed Needs Attention OP created or responded to issue and it needs attention. labels Oct 25, 2024
@github-actions github-actions bot added the Needs Attention OP created or responded to issue and it needs attention. label Oct 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auth blocked: customer response Waiting for customer response, e.g. more information was requested. Needs Attention OP created or responded to issue and it needs attention. platform: all
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants