|
6 | 6 |
|
7 | 7 | Pre-lit Firebase authentication. It provides a set of convenient utilities and widgets to easily add Firebase authentication to a Flutter app.
|
8 | 8 |
|
| 9 | +## Table of Contents |
| 10 | +[Features](#features) |
| 11 | +- [Table of Contents](#table-of-contents) |
| 12 | +- [Features](#features) |
| 13 | +- [Getting started](#getting-started) |
| 14 | +- [Platform Configuration](#platform-configuration) |
| 15 | + - [Android integration](#android-integration) |
| 16 | + - [iOS integration](#ios-integration) |
| 17 | + - [Web integration](#web-integration) |
| 18 | +- [Usage](#usage) |
| 19 | + - [Lit Firebase Initialization](#lit-firebase-initialization) |
| 20 | + - [Standard Sign-in widget](#standard-sign-in-widget) |
| 21 | + - [Handle auth state changes](#handle-auth-state-changes) |
| 22 | + - [Auth success and failure](#auth-success-and-failure) |
| 23 | + - [Sign out](#sign-out) |
| 24 | + - [Get current user](#get-current-user) |
| 25 | + - [Watch user for changes](#watch-user-for-changes) |
| 26 | + - [Determine if submitting is active](#determine-if-submitting-is-active) |
| 27 | +- [Authentication Providers](#authentication-providers) |
| 28 | + - [Initialization](#initialization) |
| 29 | + - [Google Sign In for Android](#google-sign-in-for-android) |
| 30 | + - [Google Sign In for iOS](#google-sign-in-for-ios) |
| 31 | + - [iOS additional requirement](#ios-additional-requirement) |
| 32 | + - [Apple Sign In for iOS](#apple-sign-in-for-ios) |
| 33 | + - [Twitter Sign In for iOS and Android](#twitter-sign-in-for-ios-and-android) |
| 34 | + - [Using with Lit Firebase Auth](#using-with-lit-firebase-auth) |
| 35 | +- [Decoration and theming](#decoration-and-theming) |
| 36 | + - [Standard Sign-in widget customization](#standard-sign-in-widget-customization) |
| 37 | + - [Notifications](#notifications) |
| 38 | + - [Additional Customization](#additional-customization) |
| 39 | + - [Icons](#icons) |
| 40 | +- [Planned features](#planned-features) |
| 41 | +- [Dart Versions](#dart-versions) |
| 42 | +- [Maintainers](#maintainers) |
| 43 | +- [Starware](#starware) |
9 | 44 |
|
10 | 45 | ## Features
|
11 | 46 |
|
@@ -36,34 +71,14 @@ Or take a look at a [live demo](https://funwithflutter.github.io/lit_firebase_ex
|
36 | 71 |
|
37 | 72 | ### Android integration
|
38 | 73 |
|
39 |
| -Enable the Google services by configuring the Gradle scripts as such. |
40 |
| - |
41 |
| -1. Add the classpath to the `[project]/android/build.gradle` file. |
42 |
| -```gradle |
43 |
| -dependencies { |
44 |
| - // Example existing classpath |
45 |
| - classpath 'com.android.tools.build:gradle:3.2.1' |
46 |
| - // Add the google services classpath |
47 |
| - classpath 'com.google.gms:google-services:4.3.0' |
48 |
| -} |
49 |
| -``` |
50 |
| - |
51 |
| -2. Add the apply plugin to the `[project]/android/app/build.gradle` file. |
52 |
| -```gradle |
53 |
| -// ADD THIS AT THE BOTTOM |
54 |
| -apply plugin: 'com.google.gms.google-services' |
55 |
| -``` |
56 |
| - |
57 |
| -*Note:* If this section is not completed you will get an error like this: |
58 |
| -``` |
59 |
| -java.lang.IllegalStateException: |
60 |
| -Default FirebaseApp is not initialized in this process [package name]. |
61 |
| -Make sure to call FirebaseApp.initializeApp(Context) first. |
62 |
| -``` |
| 74 | +Follow normal [Firebase Initialization](https://firebase.flutter.dev/docs/installation/android) |
63 | 75 |
|
64 | 76 | *Note:* When you are debugging on android, use a device or AVD with Google Play services.
|
65 | 77 | Otherwise you will not be able to authenticate.
|
66 | 78 |
|
| 79 | +### iOS integration |
| 80 | +Follow normal [Firebase Initialization](https://firebase.flutter.dev/docs/installation/ios) |
| 81 | + |
67 | 82 | ### Web integration
|
68 | 83 |
|
69 | 84 | You'll need to modify the `web/index.html` of your app following the Firebase setup instructions:
|
@@ -243,6 +258,72 @@ Should only be used in the build method.
|
243 | 258 |
|
244 | 259 | ## Authentication Providers
|
245 | 260 |
|
| 261 | +### Initialization |
| 262 | +Enable the sign-in method you want to use in firebase console |
| 263 | + |
| 264 | +### Google Sign In for Android |
| 265 | + |
| 266 | +To access Google Sign-In, you'll need to make sure to [register your |
| 267 | +application](https://developers.google.com/mobile/add?platform=android). |
| 268 | + |
| 269 | +You don't need to include the google-services.json file in your app unless you |
| 270 | +are using Google services that require it. You do need to enable the OAuth APIs |
| 271 | +that you want, using the [Google Cloud Platform API |
| 272 | +manager](https://console.developers.google.com/). For example, if you |
| 273 | +want to mimic the behavior of the Google Sign-In sample app, you'll need to |
| 274 | +enable the [Google People API](https://developers.google.com/people/). |
| 275 | + |
| 276 | +Make sure you've filled out all required fields in the console for [OAuth consent screen](https://console.developers.google.com/apis/credentials/consent). Otherwise, you may encounter `APIException` errors. |
| 277 | + |
| 278 | +### Google Sign In for iOS |
| 279 | + |
| 280 | +1. [First register your application](https://developers.google.com/mobile/add?platform=ios). |
| 281 | +2. Make sure the file you download in step 1 is named `GoogleService-Info.plist`. |
| 282 | +3. Move or copy `GoogleService-Info.plist` into the `[my_project]/ios/Runner` directory. |
| 283 | +4. Open Xcode, then right-click on `Runner` directory and select `Add Files to "Runner"`. |
| 284 | +5. Select `GoogleService-Info.plist` from the file manager. |
| 285 | +6. A dialog will show up and ask you to select the targets, select the `Runner` target. |
| 286 | +7. Then add the `CFBundleURLTypes` attributes below into the `[my_project]/ios/Runner/Info.plist` file. |
| 287 | + |
| 288 | +```xml |
| 289 | +<!-- Put me in the [my_project]/ios/Runner/Info.plist file --> |
| 290 | +<!-- Google Sign-in Section --> |
| 291 | +<key>CFBundleURLTypes</key> |
| 292 | +<array> |
| 293 | + <dict> |
| 294 | + <key>CFBundleTypeRole</key> |
| 295 | + <string>Editor</string> |
| 296 | + <key>CFBundleURLSchemes</key> |
| 297 | + <array> |
| 298 | + <!-- TODO Replace this value: --> |
| 299 | + <!-- Copied from GoogleService-Info.plist key REVERSED_CLIENT_ID --> |
| 300 | + <string>com.googleusercontent.apps.861823949799-vc35cprkp249096uujjn0vvnmcvjppkn</string> |
| 301 | + </array> |
| 302 | + </dict> |
| 303 | +</array> |
| 304 | +<!-- End of the Google Sign-in Section --> |
| 305 | +``` |
| 306 | +### iOS additional requirement |
| 307 | + |
| 308 | +Note that according to https://developer.apple.com/sign-in-with-apple/get-started, |
| 309 | +starting June 30, 2020, apps that use login services must also offer a "Sign in |
| 310 | +with Apple" option when submitting to the Apple App Store. |
| 311 | + |
| 312 | +Consider also using an Apple sign in plugin from pub.dev. |
| 313 | + |
| 314 | +The Flutter Favorite [sign_in_with_apple](https://pub.dev/packages/sign_in_with_apple) |
| 315 | +plugin could be an option. |
| 316 | + |
| 317 | +### Apple Sign In for iOS |
| 318 | + |
| 319 | +1. [Configure your app](https://help.apple.com/developer-account/#/devde676e696) in Xcode to add the "Sign In with Apple" capability |
| 320 | + |
| 321 | +### Twitter Sign In for iOS and Android |
| 322 | +1. Register your app as a developer application in [Twitter Developer Portal](https://developer.twitter.com/en) |
| 323 | +2. Copy Paste your API Key and API Secret into the Twitter Sign In Method in Firebase |
| 324 | +3. Enable 3rd party authentication in Twitter Developer Portal and copy past callback URL from Firebase |
| 325 | + |
| 326 | +### Using with Lit Firebase Auth |
246 | 327 | The supported third-party providers are:
|
247 | 328 | * Google
|
248 | 329 | * Apple
|
@@ -455,18 +536,18 @@ This will display a column of icons (images).
|
455 | 536 | ## Planned features
|
456 | 537 |
|
457 | 538 |
|
458 |
| -| | State | | |
459 |
| -| ----------------- | ---------- | ---------------------------------------------------------------- | |
460 |
| -| Platforms | ⌛ | Support more platforms (Windows, macOS, Linux) | |
461 |
| -| Auth providers | ⌛ | Support more authentication providers (Facebook, Microsoft) | |
462 |
| -| Cupertino | ⌛ | Cupertino look and feel | |
463 |
| -| Password reset | ❌ | Add services and UI to reset password/email | |
464 |
| -| Email confirmation| ❌ | Add UI to notify users they need to confirm their email address | |
465 |
| -| Support UI | ❌ | Assist users who cannot authenticate with support links | |
466 |
| -| Custom dialogs | ✔️ | Add support to customize dialog messages | |
467 |
| -| Adaptive layouts | ⌛ | Adaptive layouts to support multiple screen sizes | |
468 |
| -| Customization | ✔️ | Even more, or easier, customization | |
469 |
| -| Testing | ❌ | Add testing | |
| 539 | +| | State | | |
| 540 | +| ------------------ | ----- | --------------------------------------------------------------- | |
| 541 | +| Platforms | ⌛ | Support more platforms (Windows, macOS, Linux) | |
| 542 | +| Auth providers | ⌛ | Support more authentication providers (Facebook, Microsoft) | |
| 543 | +| Cupertino | ⌛ | Cupertino look and feel | |
| 544 | +| Password reset | ❌ | Add services and UI to reset password/email | |
| 545 | +| Email confirmation | ❌ | Add UI to notify users they need to confirm their email address | |
| 546 | +| Support UI | ❌ | Assist users who cannot authenticate with support links | |
| 547 | +| Custom dialogs | ✔️ | Add support to customize dialog messages | |
| 548 | +| Adaptive layouts | ⌛ | Adaptive layouts to support multiple screen sizes | |
| 549 | +| Customization | ✔️ | Even more, or easier, customization | |
| 550 | +| Testing | ❌ | Add testing | |
470 | 551 |
|
471 | 552 | ## Dart Versions
|
472 | 553 |
|
|
0 commit comments