![]() ![]() In this case, we are taking the FirebaseAuth instance object and calling the currentUser method on it to get the currently signed in user. Just as we were able to use a Stream Builder widget to dynamically change the widget tree in the base application, we are also able to display information about the user to our home screen. In this case, we are able to easily pass the user data from the API provider to the view layer of our application. This is useful because it allows the application to keep the same instance of the object consistent across the entire code base. Item 3: Using the Singleton Pattern to Fetch Consistent Dataįirebase Authentication and the libraries surrounding Firebase all use the Singleton Pattern. The information is then passed back into firebase on a successful authentication. These tokens are passed into the FirebaseUser object which then confirms that the user is indeed who they say they are. We then are able to get the Authentication Tokens from this sign in event through our GoogleSignInAuthentication object. First, we ask Google to authenticate the user by having them sign in to the Google Playstore or another Google application. This image shows the method that we use to authenticate the user inside of our application. We also avoid potential security risks which come from using a more traditional validation system that actually requires that the user inputs their email and password into our application. This allows us to authenticate our users from a single click. One of the larger advantages of using the Firebase Authentication system is that it makes use of the OAuth 2.0 standard. Item 2: Using OAuth 2.0 Inside of Flutter This rule set is very simple but it can be expanded in different ways for various types of applications. These rules only allow a user to read and write our data if the request they make is authenticated beforehand. This image shows the rules that were used for our cloud firestore database in this application. We are also able to personalize the application experience with this information to increase application retention. This allows us to preform analytics as well as save security data in the cloud. With Firebase we are able to not only restrict which users can read and write from our database, we can also use the authentication to identify the users. There are various reasons why you would want to authenticate a user in a mobile application. Outline for this Tutorial Item 1: Authentication via Google for Firebase/Firestore The Singleton pattern is also used and we use assertions in our provider logic. We also make use of the Image Filter Widget in this application to allow us to create a unique aesthetic for our login page. If they are authenticated then the user can read and write to our Firestore database. Google sends a token to the Firebase console which them verifies that the user is authenticated. The application uses a login page which allows the user to navigate to the home page only if the user is authenticated by Google. ![]() In this Flutter Video Tutorial, we take a look at how it is possible to authenticate a user using the Google Sign In plugin inside of Firebase and Firestore. Some understanding of realtime databases.A fair understanding of Mobile development and Imperative or Object Oriented Programming.A little understanding of key/value stores.An Android or iOS Emulator or device for testing.The Flutter SDK on the latest Master Build.IDEA intellij, Visual Studio Code with the Dart/Flutter Plugins, Android Studio or Xcode.You will learn how to use assertions and logic to verify data.You will learn how to manage singleton object in a provider class.You will learn how to use image filter widgets in flutter.You will learn how to use OAuth 2.0 with Firebase/Firestore.You will learn how to use add authentication to Firebase/Firestore projects. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |