Skip to content

AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.

Implement FirebaseAuthView for Google and GitHub Sign-In

hunteraraujo4d4158454743
diff --git a/frontend/lib/views/auth/firebase_auth_view.dart b/frontend/lib/views/auth/firebase_auth_view.dart
new file mode 100644
index 0000000000..813227b5b0
--- /dev/null
+++ b/frontend/lib/views/auth/firebase_auth_view.dart
@@ -0,0 +1,71 @@
+import 'package:flutter/material.dart';
+import 'package:auto_gpt_flutter_client/services/auth_service.dart';
+
+class FirebaseAuthView extends StatelessWidget {
+ // TODO: This should be initialized in the main.dart instead of here
+ final AuthService _authService = AuthService();
+
+ FirebaseAuthView({super.key}); // Initialize the auth service
+
+ @override
+ Widget build(BuildContext context) {
+ return Scaffold(
+ body: Center(
+ child: Column(
+ mainAxisAlignment: MainAxisAlignment.center,
+ children: <Widget>[
+ OutlinedButton(
+ onPressed: () async {
+ final user = await _authService.signInWithGoogle();
+ if (user != null) {
+ print(
+ "Successfully signed in with Google: ${user.user?.displayName}");
+ }
+ },
+ style: OutlinedButton.styleFrom(
+ foregroundColor: Colors.blue,
+ side: const BorderSide(color: Colors.blue, width: 2),
+ padding:
+ const EdgeInsets.symmetric(horizontal: 20, vertical: 20),
+ ),
+ child: Row(
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ Image.asset('assets/google_logo.svg.png', width: 24),
+ const SizedBox(width: 8),
+ const Text('Sign in with Google',
+ style: TextStyle(fontWeight: FontWeight.w300)),
+ ],
+ ),
+ ),
+ const SizedBox(height: 20),
+ OutlinedButton(
+ onPressed: () async {
+ final user = await _authService.signInWithGitHub();
+ if (user != null) {
+ print(
+ "Successfully signed in with GitHub: ${user.user?.displayName}");
+ }
+ },
+ style: OutlinedButton.styleFrom(
+ foregroundColor: Colors.black,
+ side: const BorderSide(color: Colors.black, width: 2),
+ padding:
+ const EdgeInsets.symmetric(horizontal: 20, vertical: 20),
+ ),
+ child: Row(
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ Image.asset('assets/github_logo.svg.png', width: 24),
+ const SizedBox(width: 8),
+ const Text('Sign in with GitHub',
+ style: TextStyle(fontWeight: FontWeight.w300)),
+ ],
+ ),
+ ),
+ ],
+ ),
+ ),
+ );
+ }
+}