All Projects → sbis04 → Sign_in_flutter

sbis04 / Sign_in_flutter

Licence: mit
"Login Demo" app which shows how to use google sign in Android and iOS using Flutter.

Programming Languages

dart
5743 projects

Projects that are alternatives of or similar to Sign in flutter

React Firebase File Uploader
An image uploader for react that uploads images to your firebase storage
Stars: ✭ 155 (-8.82%)
Mutual labels:  firebase
Fireo
Google Cloud Firestore modern and simplest convenient ORM package in Python. FireO is specifically designed for the Google's Firestore
Stars: ✭ 163 (-4.12%)
Mutual labels:  firebase
Angular Search Experience
Algolia + Angular = 🔥🔥🔥
Stars: ✭ 167 (-1.76%)
Mutual labels:  firebase
Friendlypix Ios
Friendly Pix iOS is a sample app demonstrating how to build an iOS app with the Firebase Platform.
Stars: ✭ 157 (-7.65%)
Mutual labels:  firebase
Photostream
A photo sharing iOS app that uses Firebase and is being driven by VIPER architecture.
Stars: ✭ 162 (-4.71%)
Mutual labels:  firebase
Julienne
Sample app for sharing recipes built with React, Typescript, Firebase and Sancho
Stars: ✭ 165 (-2.94%)
Mutual labels:  firebase
Pul
PÜL - A carpooling app designed for students to help each other get more involved in their community.
Stars: ✭ 152 (-10.59%)
Mutual labels:  firebase
Tiktok Clone
An iOS Tiktok Clone built with Swift(Frontend) and Firebase(Backend)
Stars: ✭ 170 (+0%)
Mutual labels:  firebase
Cerebral
Declarative state and side effects management for popular JavaScript frameworks
Stars: ✭ 1,946 (+1044.71%)
Mutual labels:  firebase
Action Hosting Deploy
Automatically deploy shareable previews for your Firebase Hosting sites
Stars: ✭ 166 (-2.35%)
Mutual labels:  firebase
Happy Plants
🌵 Web application to manage plants
Stars: ✭ 157 (-7.65%)
Mutual labels:  firebase
Space
A real time chat app for developers built using React, Redux, Electron and Firebase
Stars: ✭ 161 (-5.29%)
Mutual labels:  firebase
Firebase React Native Redux Starter
Starter For Firebase, React Native, Redux Applications With 100% Of Code In Common Between IOS And Android, with built In Authentication, Crud Example And Form Validation.
Stars: ✭ 166 (-2.35%)
Mutual labels:  firebase
Pokidex
Android app that identifies and detects Pokemons in the provided Image using Tensorflow Lite and Firebase MLKit
Stars: ✭ 157 (-7.65%)
Mutual labels:  firebase
Fireedit
🔥 FireEdit is a real-time text editor which allows programmers work simultaneously.
Stars: ✭ 168 (-1.18%)
Mutual labels:  firebase
Gappein Chat Sdk
A plug and play modular toolkit for integrating the Chat feature on top of Firebase!
Stars: ✭ 154 (-9.41%)
Mutual labels:  firebase
Workshops
Workshops organized to introduce students to security, AI, AR/VR, hardware and software
Stars: ✭ 162 (-4.71%)
Mutual labels:  firebase
Rest app
Authentication + Splash Screen Flutter UI, UI created getting inspired from one share on dribble with flutter
Stars: ✭ 169 (-0.59%)
Mutual labels:  firebase
Fcm
Firebase Cloud Messaging (FCM) notifications channel for Laravel
Stars: ✭ 169 (-0.59%)
Mutual labels:  firebase
Awesome Opensource Apps
🏠ℹ️ Curated list of awesome open source crafted web & mobile applications - Learn, Fork, Contribute & Most Importantly Enjoy!
Stars: ✭ 2,199 (+1193.53%)
Mutual labels:  firebase

⚠️ ARCHIVED: This repository is using Flutter 1.7 for the sample app. You can find the latest version of the similar implementation on this new repo. The new version is using Flutter 2.0 (stable) with null safety enabled, and is tested on Android, iOS & Web.

The updated Medium article for "Flutter: Implementing Google Sign In" is here.


Flutter Google Sign In using Firebase

codemagic

Checkout my Medium article "Flutter: Implementing Google Sign In".

In this app, I have implemented Google Sign In using Firebase for both Android and iOS, fixing all the issues with the latest Flutter updates. To understand how to fix all the Firebase issues in Flutter make sure you check out my Medium article.

NOTE: The project is tested on Flutter 1.7 (stable) and using all the latest versions of the plugins.

Project versions

There are three versions of this project available:

  • Simple Google Sign In (master)
  • Combined with Auto Login (auto_login)
  • Combined with Local Authentication using Biometric (local_auth)

Using this app

If you want to clone and use this app, then you have to complete the following steps:

Step 1: Generate the SHA-1

Use the following command to generate SHA-1:

keytool -list -v \
-alias androiddebugkey -keystore ~/.android/debug.keystore

Step 2: Complete the Firebase setup

First of all, complete the whole Firebase setup for both Android and iOS. You will get two files while doing the setup, one for each platform. You have to place the google-services.json & GoogleService-Info.plist files in the respective directory of each platform. For more info, check out my Medium article.

NOTE: USE THE SHA-1 GENERATED FROM YOUR SYSTEM

Step 3: Completing the iOS integration

For the iOS part, you have to do one more step. You will find a TODO in Info.plist file, just complete that.

Step 4: Run the app

Now, you can run the app on your device using the command:

flutter run

Screenshots

Plugins

The plugins used in this project are:

  1. firebase_core
  2. firebase_auth.
  3. google_sign_in.

Add this to your package's pubspec.yaml file to use Firebase & Google Sign In:

dependencies:
  firebase_core: ^0.5.0
  firebase_auth: ^0.18.0+1
  google_sign_in: ^4.5.3

Import using:

import 'package:firebase_auth/firebase_auth.dart';
import 'package:firebase_core/firebase_core.dart';
import 'package:google_sign_in/google_sign_in.dart';

Methods

Following are two useful methods for authentication using Firebase and Google Sign In. You can use these as the basic template for your starting project.

NOTE: These does not check for all edge cases and you should add other security restrictions as per your requirement in your production app

For signing in using a Google account:

Future<String> signInWithGoogle() async {
  await Firebase.initializeApp();

  final GoogleSignInAccount googleSignInAccount = await googleSignIn.signIn();
  final GoogleSignInAuthentication googleSignInAuthentication = await googleSignInAccount.authentication;

  final AuthCredential credential = GoogleAuthProvider.credential(
    accessToken: googleSignInAuthentication.accessToken,
    idToken: googleSignInAuthentication.idToken,
  );

  final UserCredential authResult = await _auth.signInWithCredential(credential);
  final User user = authResult.user;

  if (user != null) {
    // Checking if email and name is null
    assert(user.email != null);
    assert(user.displayName != null);
    assert(user.photoURL != null);

    name = user.displayName;
    email = user.email;
    imageUrl = user.photoURL;

    assert(!user.isAnonymous);
    assert(await user.getIdToken() != null);

    final User currentUser = _auth.currentUser;
    assert(user.uid == currentUser.uid);

    print('signInWithGoogle succeeded: $user');

    return '$user';
  }

  return null;
}

For signing out of a Google account:

Future<void> signOutGoogle() async {
  await googleSignIn.signOut();

  print("User Signed Out");
}

License

Copyright (c) 2019 Souvik Biswas

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].