Flutter app world logo
  • Home
  • Flutter App
    • UI
    • ads
    • Timeline
    • Widgets
    • Plugin
    • Games
    • library
    • Templates
    • Maps
    • Timeline
    • clock
    • Animation
    • packages
  • Dart
  • Marketplace

A Flutter package that implements Google Sign In

 October 4, 2021   packages, Packages, Sign in

google_sign_in_dartio

A Flutter package that implements Google Sign In in pure Dart. This package is compatible with google_sign_in plugin and works on all platforms Flutter supports but it’s intended to be mainly used on Desktop.

Getting Started

Install and initialization

  1. Depend on itdependencies: google_sign_in: ^4.1.4 google_sign_in_dartio: ^0.0.6
  2. Run flutter pub get
  3. Importimport ‘package:google_sign_in/google_sign_in.dart’; import ‘package:google_sign_in_dartio/google_sign_in_dartio.dart’;
  4. Register the packageimport ‘package:flutter/material.dart’; import ‘package:google_sign_in/google_sign_in.dart’; import ‘package:google_sign_in_dartio/google_sign_in_dartio.dart’; void main() { if (isDesktop) { GoogleSignInPlatform.register(clientId: <clientId>); } runApp(MyApp()); }Note: You might want to await for the register method to finish before calling any GoogleSignIn methods when your app starts.

Usage

You can use the normal GoogleSignIn methods.

final GoogleSignInAccount account = await GoogleSignIn().signIn();

Obtain a Client ID for your Desktop app

  1. Go to the Google Cloud Platform console and select you project
  2. Go to APIs & Service -> Credentials
  3. Create new credentials for your app by selecting CREATE CREDENTIALS and then OAuth client ID
  4. Select Other as Application type, give it a name (eg. macOS) and then click Create

Provide a code exchange endpoint

The user accessToken expires after about one hour, after witch you need to ask the user to login again. If you want to keep the user logged in, you need to deploy a oAuth code exchange endpoint. Once you have your endpoint you can register the package like this.

NOTE:

If you use this only for FirebaseAuth you don’t need the code exchange since the token must be valid only when you use the signInWithCredentials method.

    import 'package:flutter/material.dart';
    import 'package:google_sign_in/google_sign_in.dart';
    import 'package:google_sign_in_dartio/google_sign_in_dartio.dart';
    
    void main() {
      if (isDesktop) {
        GoogleSignInPlatform.register(
            clientId: <clientId>, 
            exchangeEndpoint: <endpoint>,
        );
      }
    
      runApp(MyApp());
    }

NOTE:

GoogleSignInTokenData exposes serverAuthCode field that should contain the exchange code from the authorization request. This will always be null when using this package because we already allow you to provide a code exchange endpoint witch exposes the code and code verifier in a trusted environment and encourages not to do the code exchange on the client.

Contribute on GitHub

https://github.com/long1eu/google_sign_in_dart
Flutterappworld
Flutterappworld

Provides the list of the opensource Flutter apps collection with GitHub repository.

<< An application explains about one of the heroes in Indonesia A simple Quran app made with flutter >>

Flutter App Templates

Flutter App Template

Subscribe

Loading

Recent Posts

  • Flutter Client SDK for LiveKit
  • PrepPDF app provides organised access to previous year question papers and solutions
  • The project is a Flutter library for SMS verification codes
  • OpSo – Open Source Programs App
  • Learning app for kids

Categories

  • 3D
  • Admin
  • ads
  • AI
  • Alert
  • Algorithm
  • Analytics
  • Animation
  • Ant
  • API
  • Article
  • Audio
  • Authentication
  • Avatar
  • Backend
  • Badges
  • Bank
  • Barcode
  • Binding
  • Bitcoin Ticker
  • Bitwarden
  • BLoC
  • Blockchain
  • Bluetooth
  • Blur
  • BMI
  • Book
  • Booking
  • Button
  • Cache
  • calculator
  • Calendar
  • Camera
  • canvas
  • Captcha
  • Carousel
  • Carousel
  • Cart
  • Chart
  • chat
  • Chips
  • Choice
  • Class
  • Clipboard
  • Clipper
  • clock
  • Collection
  • Colors
  • Command Line
  • Community
  • Contact
  • Converter
  • Country Code
  • Covid-19
  • Crypto Currency
  • Cupertino
  • Currency
  • Dart
  • Dashboard
  • Database
  • Date & Time
  • Designs
  • Desktop
  • Desktop App
  • Dev Tool
  • Dialog
  • Doctor App
  • Downloader
  • Draw
  • Drawer
  • Dropdown
  • E-Learning
  • ecommerce
  • Editor
  • Education
  • Effect
  • Emoji
  • Encryption
  • Event
  • Exercises
  • Extension
  • Face Detection
  • Facebook
  • Feeds
  • Figma
  • File Manager
  • Files
  • Firebase
  • Flight
  • Floating
  • Flutter App
  • Flutter Card
  • Flutter Desktop
  • Food Ordering
  • Form
  • Framework
  • Furniture
  • Furniture Store
  • Games
  • Generator
  • Geocoding
  • Google Sheets
  • Graphics
  • GraphQL
  • Gravatar
  • grid
  • Grocery
  • Header
  • Health
  • Hooks
  • Http
  • Icons
  • Img
  • Input
  • IoT
  • Javascript
  • Json
  • Keyboard
  • Language Learning
  • Launcher
  • Laundry
  • Layout
  • Library
  • library
  • List
  • ListTile
  • Loader
  • Location
  • Login
  • Machine Learning
  • Mail
  • Maps
  • Marketplace
  • Material Design
  • Media
  • Medical
  • Menu
  • Messenger App
  • Meta Layer
  • Mobx
  • Movie
  • Music Player
  • MVC
  • Navigation
  • Navigation bar
  • Network
  • Neumorphic
  • News
  • Notes App
  • NuBank
  • on-boarding
  • OnBoarding
  • OTP
  • packages
  • Packages
  • Padding
  • Paginating
  • PAGINATION
  • parallax
  • Parser
  • Password
  • Payment Gateway
  • PDF
  • Picker
  • Pie chart
  • Pin Code
  • Pizza
  • Plugin
  • plugin
  • Podcast
  • popup
  • portfolio
  • POS
  • Progress
  • Push Notification
  • QR Code
  • Quiz
  • Radio Component
  • Rating Bar
  • Redux
  • Refresh
  • Remote
  • Render
  • Responsive
  • Rest API
  • Restaurants
  • Ribbon
  • Routing
  • School App
  • Screen
  • Scroll
  • Search
  • Shopping
  • Sidebar
  • Sign in
  • Simulator
  • Skeleton
  • Slider
  • SMS
  • Social Media
  • Solar
  • Splash screens
  • State Management
  • Stickers
  • Stocks Market
  • Streaming
  • SVG
  • Swagger
  • Swipe
  • Switch
  • TabBar
  • Table
  • Tags
  • Task Manager
  • Taxi
  • Templates
  • Testing
  • Text
  • Text Field
  • Theme
  • TikTok
  • Time Tracking
  • Timeline
  • Timelines
  • Toast
  • Todo
  • Toggle
  • Tools
  • Transition
  • Translator
  • Transport
  • Travel
  • TV app
  • Twitter
  • UI
  • Uncategorized
  • UX
  • Video
  • Video Conferencing
  • video player
  • Visualization
  • Wallet
  • Wallpapers
  • Watch
  • Weather
  • web app
  • Web Scraping
  • website
  • WeChat
  • Widgets
  • WooCommerce
  • wrapper
  • XML
  • Yoga

  • About US
  • Privacy Policy
  • Submit App
  • Web Stories
    • Free Online Food Delivery Apps for Business
    • Top 5 Flutter Applicatons – Open Source
    • Free Food Ordering App
This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Cookie settingsACCEPT
Privacy & Cookies Policy

Privacy Overview

This website uses cookies to improve your experience while you navigate through the website. Out of these cookies, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may have an effect on your browsing experience.
Necessary
Always Enabled
Necessary cookies are absolutely essential for the website to function properly. This category only includes cookies that ensures basic functionalities and security features of the website. These cookies do not store any personal information.
Non-necessary
Any cookies that may not be particularly necessary for the website to function and is used specifically to collect user personal data via analytics, ads, other embedded contents are termed as non-necessary cookies. It is mandatory to procure user consent prior to running these cookies on your website.
SAVE & ACCEPT