{"id":32535,"date":"2024-11-01T09:09:48","date_gmt":"2024-11-01T09:09:48","guid":{"rendered":"http:\/\/atmokpo.com\/w\/?p=32535"},"modified":"2024-11-01T11:54:54","modified_gmt":"2024-11-01T11:54:54","slug":"flutter-course-16-2-integrating-the-login-app-with-firebase-project","status":"publish","type":"post","link":"https:\/\/atmokpo.com\/w\/32535\/","title":{"rendered":"Flutter Course: 16.2 Integrating the Login App with Firebase Project"},"content":{"rendered":"<p>In this course, we will learn how to create a login app using Flutter and integrate it with Google&#8217;s Firebase backend. By the end of the course, you will have created a basic app that allows users to log in with their email and password. Firebase is a tool that provides various features, including authentication, data storage, and hosting, for applications. Many developers use this service to develop apps quickly and easily.<\/p>\n<h2>1. Preparation<\/h2>\n<p>First, we need to prepare to use Flutter and Firebase. Please check the following requirements:<\/p>\n<ul>\n<li>Programming environment: Flutter SDK must be installed.<\/li>\n<li>You need to create a Firebase account.<\/li>\n<li>Prepare an IDE (e.g., Visual Studio Code or Android Studio).<\/li>\n<li>You need to set up a project in the Firebase console to use Firebase Authentication.<\/li>\n<\/ul>\n<h2>2. Create a Flutter Project<\/h2>\n<p>First, we create a new Flutter project. In the terminal, enter the following command:<\/p>\n<pre><code>flutter create login_app<\/code><\/pre>\n<p>Now, let&#8217;s navigate to the created directory and open the project:<\/p>\n<pre><code>cd login_app<\/code><\/pre>\n<h2>3. Set Up Firebase<\/h2>\n<h3>3.1 Create a New Project in Firebase Console<\/h3>\n<p>1. Log in to the Firebase console. <a href=\"https:\/\/console.firebase.google.com\/\">Firebase Console<\/a><\/p>\n<p>2. Click &#8220;Add Project&#8221; to create a new project.<\/p>\n<p>3. Complete the project&#8217;s name and initial settings.<\/p>\n<h3>3.2 Activate Firebase Authentication<\/h3>\n<p>1. From the dashboard of the newly created project, select &#8220;Authentication&#8221; from the menu.<\/p>\n<p>2. Go to the &#8220;Sign-in Method&#8221; tab and enable &#8220;Email\/Password&#8221; login.<\/p>\n<h3>3.3 Register the Android App<\/h3>\n<p>1. Click the Android icon on the dashboard to register the Android app.<\/p>\n<p>2. Enter the package name; you do not need to input the SHA-1 key for testing purposes.<\/p>\n<p>3. Click the &#8220;Register&#8221; button.<\/p>\n<p>4. Download the google-services.json file and add it to the android\/app directory.<\/p>\n<h3>3.4 Install Firebase CLI<\/h3>\n<p>The Firebase CLI tool makes it easy to perform Firebase-related tasks. Install Firebase CLI with the following command:<\/p>\n<pre><code>npm install -g firebase-tools<\/code><\/pre>\n<h2>4. Integrate Flutter with Firebase<\/h2>\n<h3>4.1 Modify pubspec.yaml File<\/h3>\n<p>Open the pubspec.yaml file in your Flutter project, and add the following packages:<\/p>\n<pre><code>\ndependencies:\n  flutter:\n    sdk: flutter\n  firebase_core: latest_version\n  firebase_auth: latest_version\n<\/code><\/pre>\n<p>After adding the packages, install them with the following command:<\/p>\n<pre><code>flutter pub get<\/code><\/pre>\n<h3>4.2 Initialize Firebase<\/h3>\n<p>Initialize Firebase in the main.dart file. To initialize the Firebase app, add the following code:<\/p>\n<pre><code>\nimport 'package:firebase_core\/firebase_core.dart';\n\nvoid main() async {\n  WidgetsFlutterBinding.ensureInitialized();\n  await Firebase.initializeApp();\n  runApp(MyApp());\n}\n<\/code><\/pre>\n<h2>5. Implement Login UI<\/h2>\n<p>Now it&#8217;s time to implement the login screen. We will use StatefulWidget to create a basic login screen.<\/p>\n<pre><code>\nimport 'package:flutter\/material.dart';\nimport 'package:firebase_auth\/firebase_auth.dart';\n\nclass LoginScreen extends StatefulWidget {\n  @override\n  _LoginScreenState createState() => _LoginScreenState();\n}\n\nclass _LoginScreenState extends State<LoginScreen> {\n  final _emailController = TextEditingController();\n  final _passwordController = TextEditingController();\n  String? _errorMessage;\n\n  Future<void> _login() async {\n    try {\n      await FirebaseAuth.instance.signInWithEmailAndPassword(\n        email: _emailController.text.trim(),\n        password: _passwordController.text.trim(),\n      );\n      \/\/ Handle after successful login\n    } on FirebaseAuthException catch (e) {\n      setState(() {\n        _errorMessage = e.message;\n      });\n    }\n  }\n\n  @override\n  Widget build(BuildContext context) {\n    return Scaffold(\n      appBar: AppBar(title: Text('Login')),\n      body: Padding(\n        padding: const EdgeInsets.all(16.0),\n        child: Column(\n          mainAxisAlignment: MainAxisAlignment.center,\n          children: [\n            TextField(\n              controller: _emailController,\n              decoration: InputDecoration(labelText: 'Email'),\n            ),\n            TextField(\n              controller: _passwordController,\n              obscureText: true,\n              decoration: InputDecoration(labelText: 'Password'),\n            ),\n            SizedBox(height: 20),\n            ElevatedButton(\n              onPressed: _login,\n              child: Text('Login'),\n            ),\n            if (_errorMessage != null)\n              Text(\n                _errorMessage!,\n                style: TextStyle(color: Colors.red),\n              ),\n          ],\n        ),\n      ),\n    );\n  }\n}\n<\/void><\/loginscreen><\/code><\/pre>\n<h2>6. Test the App<\/h2>\n<p>Once you have completed the above code, try running the app. You can use the Android Emulator provided by Flutter or a physical device. Enter the following command in the terminal to run the app:<\/p>\n<pre><code>flutter run<\/code><\/pre>\n<h2>7. Additional Features<\/h2>\n<p>In addition to the login feature, you can add the following functionalities for better user convenience:<\/p>\n<ul>\n<li>Sign-up feature<\/li>\n<li>Password reset feature<\/li>\n<li>Social login feature (Google, Facebook, etc.)<\/li>\n<\/ul>\n<h2>8. Conclusion<\/h2>\n<p>In this course, we learned how to create a login app integrated with Firebase using Flutter. Firebase is a useful backend solution that provides various features such as databases and storage, allowing for the implementation of a wider range of functionalities. We hope your login app works great!<\/p>\n<h2>9. References<\/h2>\n<ul>\n<li><a href=\"https:\/\/flutter.dev\/docs\/get-started\/install\">Flutter Installation Guide<\/a><\/li>\n<li><a href=\"https:\/\/firebase.google.com\/docs\/web\/setup\">Firebase Web Setup Guide<\/a><\/li>\n<li><a href=\"https:\/\/firebase.google.com\/docs\/auth\/flutter\/start\">Firebase Auth Flutter Guide<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>In this course, we will learn how to create a login app using Flutter and integrate it with Google&#8217;s Firebase backend. By the end of the course, you will have created a basic app that allows users to log in with their email and password. Firebase is a tool that provides various features, including authentication, &hellip; <a href=\"https:\/\/atmokpo.com\/w\/32535\/\" class=\"more-link\">\ub354 \ubcf4\uae30<span class=\"screen-reader-text\"> &#8220;Flutter Course: 16.2 Integrating the Login App with Firebase Project&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[151],"tags":[],"class_list":["post-32535","post","type-post","status-publish","format-standard","hentry","category-flutter-course"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.2 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Flutter Course: 16.2 Integrating the Login App with Firebase Project - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/atmokpo.com\/w\/32535\/\" \/>\n<meta property=\"og:locale\" content=\"ko_KR\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Flutter Course: 16.2 Integrating the Login App with Firebase Project - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\" \/>\n<meta property=\"og:description\" content=\"In this course, we will learn how to create a login app using Flutter and integrate it with Google&#8217;s Firebase backend. By the end of the course, you will have created a basic app that allows users to log in with their email and password. Firebase is a tool that provides various features, including authentication, &hellip; \ub354 \ubcf4\uae30 &quot;Flutter Course: 16.2 Integrating the Login App with Firebase Project&quot;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/atmokpo.com\/w\/32535\/\" \/>\n<meta property=\"og:site_name\" content=\"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\" \/>\n<meta property=\"article:published_time\" content=\"2024-11-01T09:09:48+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-11-01T11:54:54+00:00\" \/>\n<meta name=\"author\" content=\"root\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@bebubo4\" \/>\n<meta name=\"twitter:site\" content=\"@bebubo4\" \/>\n<meta name=\"twitter:label1\" content=\"\uae00\uc4f4\uc774\" \/>\n\t<meta name=\"twitter:data1\" content=\"root\" \/>\n\t<meta name=\"twitter:label2\" content=\"\uc608\uc0c1 \ub418\ub294 \ud310\ub3c5 \uc2dc\uac04\" \/>\n\t<meta name=\"twitter:data2\" content=\"3\ubd84\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/atmokpo.com\/w\/32535\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/atmokpo.com\/w\/32535\/\"},\"author\":{\"name\":\"root\",\"@id\":\"https:\/\/atmokpo.com\/w\/#\/schema\/person\/91b6b3b138fbba0efb4ae64b1abd81d7\"},\"headline\":\"Flutter Course: 16.2 Integrating the Login App with Firebase Project\",\"datePublished\":\"2024-11-01T09:09:48+00:00\",\"dateModified\":\"2024-11-01T11:54:54+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/atmokpo.com\/w\/32535\/\"},\"wordCount\":499,\"publisher\":{\"@id\":\"https:\/\/atmokpo.com\/w\/#organization\"},\"articleSection\":[\"Flutter course\"],\"inLanguage\":\"ko-KR\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/atmokpo.com\/w\/32535\/\",\"url\":\"https:\/\/atmokpo.com\/w\/32535\/\",\"name\":\"Flutter Course: 16.2 Integrating the Login App with Firebase Project - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\",\"isPartOf\":{\"@id\":\"https:\/\/atmokpo.com\/w\/#website\"},\"datePublished\":\"2024-11-01T09:09:48+00:00\",\"dateModified\":\"2024-11-01T11:54:54+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/atmokpo.com\/w\/32535\/#breadcrumb\"},\"inLanguage\":\"ko-KR\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/atmokpo.com\/w\/32535\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/atmokpo.com\/w\/32535\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\ud648\",\"item\":\"https:\/\/atmokpo.com\/w\/en\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Flutter Course: 16.2 Integrating the Login App with Firebase Project\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/atmokpo.com\/w\/#website\",\"url\":\"https:\/\/atmokpo.com\/w\/\",\"name\":\"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/atmokpo.com\/w\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/atmokpo.com\/w\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"ko-KR\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/atmokpo.com\/w\/#organization\",\"name\":\"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\",\"url\":\"https:\/\/atmokpo.com\/w\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"ko-KR\",\"@id\":\"https:\/\/atmokpo.com\/w\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/atmokpo.com\/w\/wp-content\/uploads\/2024\/11\/logo.png\",\"contentUrl\":\"https:\/\/atmokpo.com\/w\/wp-content\/uploads\/2024\/11\/logo.png\",\"width\":400,\"height\":400,\"caption\":\"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\"},\"image\":{\"@id\":\"https:\/\/atmokpo.com\/w\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/x.com\/bebubo4\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/atmokpo.com\/w\/#\/schema\/person\/91b6b3b138fbba0efb4ae64b1abd81d7\",\"name\":\"root\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"ko-KR\",\"@id\":\"https:\/\/atmokpo.com\/w\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/708197b41fc6435a7ce22d951b25d4a47e9e904270cb1f04682d4f025066f80c?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/708197b41fc6435a7ce22d951b25d4a47e9e904270cb1f04682d4f025066f80c?s=96&d=mm&r=g\",\"caption\":\"root\"},\"sameAs\":[\"http:\/\/atmokpo.com\/w\"],\"url\":\"https:\/\/atmokpo.com\/w\/author\/root\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Flutter Course: 16.2 Integrating the Login App with Firebase Project - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/atmokpo.com\/w\/32535\/","og_locale":"ko_KR","og_type":"article","og_title":"Flutter Course: 16.2 Integrating the Login App with Firebase Project - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","og_description":"In this course, we will learn how to create a login app using Flutter and integrate it with Google&#8217;s Firebase backend. By the end of the course, you will have created a basic app that allows users to log in with their email and password. Firebase is a tool that provides various features, including authentication, &hellip; \ub354 \ubcf4\uae30 \"Flutter Course: 16.2 Integrating the Login App with Firebase Project\"","og_url":"https:\/\/atmokpo.com\/w\/32535\/","og_site_name":"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","article_published_time":"2024-11-01T09:09:48+00:00","article_modified_time":"2024-11-01T11:54:54+00:00","author":"root","twitter_card":"summary_large_image","twitter_creator":"@bebubo4","twitter_site":"@bebubo4","twitter_misc":{"\uae00\uc4f4\uc774":"root","\uc608\uc0c1 \ub418\ub294 \ud310\ub3c5 \uc2dc\uac04":"3\ubd84"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/atmokpo.com\/w\/32535\/#article","isPartOf":{"@id":"https:\/\/atmokpo.com\/w\/32535\/"},"author":{"name":"root","@id":"https:\/\/atmokpo.com\/w\/#\/schema\/person\/91b6b3b138fbba0efb4ae64b1abd81d7"},"headline":"Flutter Course: 16.2 Integrating the Login App with Firebase Project","datePublished":"2024-11-01T09:09:48+00:00","dateModified":"2024-11-01T11:54:54+00:00","mainEntityOfPage":{"@id":"https:\/\/atmokpo.com\/w\/32535\/"},"wordCount":499,"publisher":{"@id":"https:\/\/atmokpo.com\/w\/#organization"},"articleSection":["Flutter course"],"inLanguage":"ko-KR"},{"@type":"WebPage","@id":"https:\/\/atmokpo.com\/w\/32535\/","url":"https:\/\/atmokpo.com\/w\/32535\/","name":"Flutter Course: 16.2 Integrating the Login App with Firebase Project - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","isPartOf":{"@id":"https:\/\/atmokpo.com\/w\/#website"},"datePublished":"2024-11-01T09:09:48+00:00","dateModified":"2024-11-01T11:54:54+00:00","breadcrumb":{"@id":"https:\/\/atmokpo.com\/w\/32535\/#breadcrumb"},"inLanguage":"ko-KR","potentialAction":[{"@type":"ReadAction","target":["https:\/\/atmokpo.com\/w\/32535\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/atmokpo.com\/w\/32535\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\ud648","item":"https:\/\/atmokpo.com\/w\/en\/"},{"@type":"ListItem","position":2,"name":"Flutter Course: 16.2 Integrating the Login App with Firebase Project"}]},{"@type":"WebSite","@id":"https:\/\/atmokpo.com\/w\/#website","url":"https:\/\/atmokpo.com\/w\/","name":"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","description":"","publisher":{"@id":"https:\/\/atmokpo.com\/w\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/atmokpo.com\/w\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"ko-KR"},{"@type":"Organization","@id":"https:\/\/atmokpo.com\/w\/#organization","name":"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","url":"https:\/\/atmokpo.com\/w\/","logo":{"@type":"ImageObject","inLanguage":"ko-KR","@id":"https:\/\/atmokpo.com\/w\/#\/schema\/logo\/image\/","url":"https:\/\/atmokpo.com\/w\/wp-content\/uploads\/2024\/11\/logo.png","contentUrl":"https:\/\/atmokpo.com\/w\/wp-content\/uploads\/2024\/11\/logo.png","width":400,"height":400,"caption":"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8"},"image":{"@id":"https:\/\/atmokpo.com\/w\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/x.com\/bebubo4"]},{"@type":"Person","@id":"https:\/\/atmokpo.com\/w\/#\/schema\/person\/91b6b3b138fbba0efb4ae64b1abd81d7","name":"root","image":{"@type":"ImageObject","inLanguage":"ko-KR","@id":"https:\/\/atmokpo.com\/w\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/708197b41fc6435a7ce22d951b25d4a47e9e904270cb1f04682d4f025066f80c?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/708197b41fc6435a7ce22d951b25d4a47e9e904270cb1f04682d4f025066f80c?s=96&d=mm&r=g","caption":"root"},"sameAs":["http:\/\/atmokpo.com\/w"],"url":"https:\/\/atmokpo.com\/w\/author\/root\/"}]}},"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/posts\/32535","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/comments?post=32535"}],"version-history":[{"count":1,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/posts\/32535\/revisions"}],"predecessor-version":[{"id":32536,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/posts\/32535\/revisions\/32536"}],"wp:attachment":[{"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/media?parent=32535"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/categories?post=32535"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/tags?post=32535"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}