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

Configure identity for Firebase connections (email, etc) #71

Open
pappes opened this issue Nov 18, 2023 · 0 comments
Open

Configure identity for Firebase connections (email, etc) #71

pappes opened this issue Nov 18, 2023 · 0 comments

Comments

@pappes
Copy link
Owner

pappes commented Nov 18, 2023

Currently all firebase connetions are anon because flutterfire does not support linux and will fail to compile if UI screens are configured

When FirebaseIUAuth supports linux applications should set up the UI screens
see https://firebase.google.com/docs/auth/android/anonymous-auth

Could be resolved when firebase_auth_desktop issue 130 is fixed via PR 131 (has been awaiting merge since 30 July 2023)
// FirebaseExtended/flutterfire_desktop#130
// FirebaseExtended/flutterfire_desktop#131
// also https://stackoverflow.com/questions/73989832/flutterfire-cli-not-showing-windows-and-linux-as-an-option-for-platform-to-suppo

replace/extend the current code
await FirebaseAuth.instance.signInAnonymously();
to include
/FirebaseUIAuth.configureProviders([
EmailAuthProvider(),
]);
/
and


  /// Defines known routes handled by Firebase UI.
  ///
  /*List<RouteBase> getRoutes() => [  
    GoRoute(
      path: 'sign-in',
      builder: (context, state) {
        return SignInScreen(
          actions: [
            ForgotPasswordAction((context, email) {
              final uri = Uri(
                path: '/sign-in/forgot-password',
                queryParameters: <String, String?>{
                  'email': email,
                },
              );
              context.push(uri.toString());
            }),
            AuthStateChangeAction((context, state) {
              final user = switch (state) {
                final SignedIn state => state.user,
                final UserCreated state => state.credential.user,
                _ => null
              };
              if (user == null) {
                return;
              }
              if (state is UserCreated) {
                user.updateDisplayName(user.email!.split('@')[0]);
              }
              if (!user.emailVerified) {
                user.sendEmailVerification();
                const snackBar = SnackBar(
                    content: Text(
                        'Please check your email to verify your email address'));
                ScaffoldMessenger.of(context).showSnackBar(snackBar);
              }
              context.pushReplacement('/');
            }),
          ],
        );
      },
      routes: [
        GoRoute(
          path: 'forgot-password',
          builder: (context, state) {
            final arguments = state.uri.queryParameters;
            return ForgotPasswordScreen(
              email: arguments['email'],
              headerMaxExtent: 200,
            );
          },
        ),
      ],
    ),
    GoRoute(
      path: 'profile',
      builder: (context, state) {
        return ProfileScreen(
          providers: const [],
          actions: [
            SignedOutAction((context) {
              context.pushReplacement('/');
            }),
          ],
        );
      },
    ),
      ];*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant