{"id":22945408,"url":"https://github.com/ankit-slnk/flutter-google-auth-demo","last_synced_at":"2026-04-10T00:35:17.474Z","repository":{"id":226941652,"uuid":"293388232","full_name":"Ankit-Slnk/flutter-google-auth-demo","owner":"Ankit-Slnk","description":"Flutter Google Authentication demo.","archived":false,"fork":false,"pushed_at":"2022-02-23T17:19:20.000Z","size":8101,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-07T14:27:17.255Z","etag":null,"topics":["android","dart","demo","firebase","firebase-console","flutter","google-sign","googleauthenticaion","ios","java","swift"],"latest_commit_sha":null,"homepage":"https://ankitsolanki.dev","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Ankit-Slnk.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2020-09-07T00:53:10.000Z","updated_at":"2022-03-29T16:34:45.000Z","dependencies_parsed_at":"2024-03-10T18:45:26.464Z","dependency_job_id":null,"html_url":"https://github.com/Ankit-Slnk/flutter-google-auth-demo","commit_stats":null,"previous_names":["ankit-slnk/flutter-google-auth-demo"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ankit-Slnk%2Fflutter-google-auth-demo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ankit-Slnk%2Fflutter-google-auth-demo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ankit-Slnk%2Fflutter-google-auth-demo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ankit-Slnk%2Fflutter-google-auth-demo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Ankit-Slnk","download_url":"https://codeload.github.com/Ankit-Slnk/flutter-google-auth-demo/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246717056,"owners_count":20822557,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","dart","demo","firebase","firebase-console","flutter","google-sign","googleauthenticaion","ios","java","swift"],"created_at":"2024-12-14T14:32:23.415Z","updated_at":"2025-12-30T20:27:56.508Z","avatar_url":"https://github.com/Ankit-Slnk.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Flutter User Authentication using Google Demo\n\n![Flutter User Authentication using Google Demo](flutter_google_auth.png)\n\nThis demo will show us how to authenticate a user by using google.\n\n![Flutter User Authentication using Google Demo](flutter_google_auth.gif)\n\n## Setup\n\nUse latest versions of below mentioned plugins in `pubspec.yaml`.\n\n| Plugin | Pub | Explanation |\n|--------|-----|-------------|\n| [connectivity](https://github.com/flutter/plugins/tree/master/packages/connectivity/connectivity) | [![pub package](https://img.shields.io/pub/v/connectivity.svg)](https://pub.dev/packages/connectivity) | Used to check internet connectivity. \n| [google_sign_in](https://github.com/flutter/plugins) | [![pub package](https://img.shields.io/pub/v/google_sign_in.svg)](https://pub.dev/packages/google_sign_in) | Used to authenticate user using google.\n| [shared_preferences](https://github.com/PonnamKarthik/shared_preferences) | [![pub package](https://img.shields.io/pub/v/shared_preferences.svg)](https://pub.dev/packages/shared_preferences) | Used to store data locally in key-value pairs.\n| [fluttertoast](https://github.com/PonnamKarthik/FlutterToast) | [![pub package](https://img.shields.io/pub/v/fluttertoast.svg)](https://pub.dev/packages/fluttertoast) | Used to show toast.\n\nAnd then\n\n    flutter pub get\n\nVisit [Firebase Console](https://console.firebase.google.com/u/0/?pli=1) to add new project. Add `Android` and `iOS` app to that project. Add `google-services.json` and `GoogleService-Info.plist` for `Android` and `iOS` respetively to its predefined place in flutter project.\n\nNow enable `Google` Sign-in method (second tab) in Authentication. \n\nYou can also get this steps in Firebase docs for [Android](https://firebase.google.com/docs/auth/android/google-signin) and [iOS](https://firebase.google.com/docs/auth/ios/google-signin).\n\n#### For Android\n\n    \u003cuses-permission android:name=\"android.permission.INTERNET\" /\u003e\n\nPlease mention `internet` permission in `AndroidManifest.xml`. This will not affect in `debug` mode but in `release` mode it will give `socket exception`.\n\nAdd SHA-1 in firebase app \n\n    1. Open app in Android Studio\n    2. Open Gradle panel\n    3. Goto andoid -\u003e app -\u003e Tasks -\u003e android\n    4. Double click on signingReport, it will generate SHA-1\n\nAdd below line in android/build.gradle\n\n    buildscript {\n        // ...\n        dependencies {\n            // ...\n            classpath 'com.google.gms:google-services:4.3.2'\n        }\n    }\n\nAdd below line in app/build.gradle\n\n    apply plugin: 'com.android.application'\n\n    android {\n        // ...\n    }\n\n    dependencies {\n        // ...\n    }\n\n    // ADD THIS AT THE BOTTOM\n    apply plugin: 'com.google.gms.google-services'\n\n#### For iOS\n\nFollow the steps in [google_sign_in](https://pub.dev/packages/google_sign_in) library\n\n#### For Web\n\nAdd Firebase core JS SDK\n\n    \u003cscript src=\"https://www.gstatic.com/firebasejs/7.14.3/firebase-app.js\"\u003e\u003c/script\u003e\n\nAdd Firebase Auth and Analytics JS for google sign-in\n\n    \u003cscript src=\"https://www.gstatic.com/firebasejs/7.14.3/firebase-auth.js\"\u003e\u003c/script\u003e\n    \u003cscript src=\"https://www.gstatic.com/firebasejs/8.0.0/firebase-analytics.js\"\u003e\u003c/script\u003e\n\nInitialize Firebase with configuration\n\n    \u003cscript\u003e\n    var firebaseConfig = {\n      // ... your web apps configuration. This is available in your Firebase project settings.\n    };\n\n    // Initialize Firebase\n    firebase.initializeApp(firebaseConfig);\n    firebase.analytics();\n    \u003c/script\u003e\n\nAdd your web apps client id\n\n    \u003cmeta name=\"google-signin-client_id\" content=\"YOUR_CLIENT_ID.apps.googleusercontent.com\"\u003e\n\nReplace `YOUR_CLIENT_ID` with client id you get from [Firebase console](https://console.firebase.google.com) \n\n    Select Project -\u003e Authentication -\u003e Sign-in method -\u003e Google -\u003e Web SDK configuration -\u003e Web client ID\n\nWhitelist the origin of your project's client ID at [Google Console](https://console.developers.google.com/)\n\n    Credentials -\u003e OAuth 2.0 Client IDs\n    Click on Web Client\n\n    Add http://localhost:7357 in URIs in Authorized JavaScript origin\n\n    Add http://localhost:7357/auth/google/callback in URIs in Authorized redirect URIs\n\n7357 is port number\n\nMake sure you disable all ad blocker.\n\n### Check Internet Connectivity\n\n    static Future\u003cbool\u003e checkInternet() async {\n        var connectivityResult = await (Connectivity().checkConnectivity());\n        if (connectivityResult == ConnectivityResult.none) {\n            return false;\n        } else {\n            return true;\n        }\n    }\n\n### Sign-in\n\n    GoogleSignIn().signIn();\n\n### Sign-out\n\n    GoogleSignIn().signOut();\n\nFinally for android and ios\n\n    flutter run\n\nfor web\n\n    flutter run -d chrome --web-hostname localhost --web-port 7357\n\n\u003c!-- ##### Please refer to my [blogs](https://ankitsolanki.netlify.app/blog.html) for more information. --\u003e\n\nCheckout [this demo](https://flutter-web-google-auth.netlify.app/#/) in [Flutter Web](https://flutter.dev/docs/get-started/web).","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fankit-slnk%2Fflutter-google-auth-demo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fankit-slnk%2Fflutter-google-auth-demo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fankit-slnk%2Fflutter-google-auth-demo/lists"}