AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |
Back to Blog
Google sign in flutter firebase9/5/2023 ![]() Now, you have to enter the “ SHA-1 hash”.Then you have to enter an “ App nickname” which is optional (if you do not enter then an auto-generated app name would be used).On the second line, there will be your package name (eg: ). You can get the android package name from your project directory → android → app → src → main→ AndroidManifest.xml. In this form, you have to first enter the “ Android Package name”.We need to set up the firebase for this project in Android and as well as IOS separately. From here you will be able to add Firebase to your Flutter project. This will lead you to the “ Project Overview”.Now, you have to enter a “ Project name” and check the two checkboxes below.Click on “ Add project” to create a new project.Then create two methods for sign-in and sign-out for google, there are built-in methods for sign-in and sign-out, add them in the method created.Īfter the coding part we need to set up firebase account for the project:įor setting up the project, We need to create a new Firebase project you will need to go and follow the steps below. In that dart file import the two following packages:Īfter adding the dart file, create an instance for firebase_auth and google_sign_in Create a new dart file in the lib folder, where we will set up the firebase authentication and a google sign in with Flutter. Now, let’s dive into the coding part, I will just explain the important parts of the code that needed to be added. google_sign_in (for the implementation of Google Sign In)įirst of all, add the plugins in pubspec.yaml file and save it to run flutter packages get or we can use the command flutter pub get.firebase_auth (for using Firebase Authentication).flutter create īelow plugins are used in the implementation. Run the following command by using your project name. For creating the project, open a Terminal, or use the terminal in your code editor. So in this article, I will be showing how to set up the Flutter app and implement a Google sign-in using Firebase authentication.įor a better understanding, let’s create a new flutter project. Google Sign-In allows you to get users into your apps quickly and securely with little development work required. Nowadays, Google sign-in is one of the main options for login in most of the mobile apps. Make a change in the app and see them in the blink of an eye. Apps developed with Flutter look and feel great. Flutter is the only mobile SDK that provides reactive views without requiring a JavaScript bridge. Flutter is a multi-platform, open-source, and free framework for creating mobile applications, created by Google. In doing some debug, it doesn't seem to get beyond the initial line: GoogleSignInAccount? googleSignInAccount =īut I don't get any error, any warning, nothing.just a spinner that sits indefintely.In this blog, I will be showing how to set up and implement Google Sign in with Flutter. IdToken: googleSignInAuthentication?.idToken,įinal UserCredential user = await _auth.signInWithCredential(credential) GoogleSignInAuthentication? googleSignInAuthentication =Īwait googleSignInAccount?.authentication įinal AuthCredential credential = GoogleAuthProvider.credential(ĪccessToken: googleSignInAuthentication?.accessToken, GoogleSignInAccount? googleSignInAccount = ![]() GoogleSignIn _googleSignIn = GoogleSignIn( I select my account, and then I hit a white page with endless spinner. Now, when I click to Sign-in, I get the account selection screen. ![]() I added the keys, downloaded the latest google-json file to my android folder and got beyond that error. Prior to that, I was getting an API exception. I have followed the instructions on generating/adding the Sha-1, Sha-256 keys to my firebase project. I am using Google Sign-in provider in flutter, google_sign_in: ^5.1.0, Flutter ver 2.2.1 I've seen two other posts about this, but no answers that resolve it for myself. I am running into issue trying to signin to Firebase with Google Sign-in in my Flutter app. ![]()
0 Comments
Read More
Leave a Reply. |