Skip to content

Commit 799231a

Browse files
SalakarhelenafordEhespkirstywilliamsgreghesp
authored
feat(firebase_auth): v1 rework (#3140)
* feat(firebase_auth): v1 rework (#30) Co-authored-by: Salakar <[email protected]> Co-authored-by: Helena Ford <[email protected]> Co-authored-by: ehesp <[email protected]> Co-authored-by: Kirsty Williams <[email protected]> Co-authored-by: Greg Hesp <[email protected]>
1 parent cf319fc commit 799231a

File tree

199 files changed

+16321
-7416
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

199 files changed

+16321
-7416
lines changed

.github/workflows/firebase_auth.yaml

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,21 +39,27 @@ jobs:
3939
profile: Nexus 5X
4040
script: ./.github/workflows/scripts/drive-example.sh android
4141

42-
ios:
42+
apple:
4343
runs-on: macos-latest
44-
timeout-minutes: 30
44+
timeout-minutes: 40
4545
steps:
4646
- uses: actions/checkout@v1
4747
with:
4848
fetch-depth: 0
4949
- name: "Install Flutter"
50-
run: ./.github/workflows/scripts/install-flutter.sh stable
50+
run: ./.github/workflows/scripts/install-flutter.sh dev
5151
- name: "Install Tools"
52-
run: ./.github/workflows/scripts/install-tools.sh
53-
- name: "Build Example"
52+
run: |
53+
./.github/workflows/scripts/install-tools.sh
54+
flutter config --enable-macos-desktop
55+
- name: "Build iOS Example"
5456
run: ./.github/workflows/scripts/build-example.sh ios
55-
- name: "Drive Example"
57+
- name: "Drive iOS Example"
5658
run: ./.github/workflows/scripts/drive-example.sh ios
59+
- name: "Build MacOS Example"
60+
run: ./.github/workflows/scripts/build-example.sh macos
61+
- name: "Drive MacOS Example"
62+
run: ./.github/workflows/scripts/drive-example.sh macos
5763

5864
web:
5965
runs-on: ubuntu-latest

.vscode/tasks.json

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,69 @@
107107
"command": "melos exec -c 1 --scope=\"*cloud_firestore_example*\" --fail-fast -- flutter build web",
108108
"detail": "Build the Firestore Web example application",
109109
"problemMatcher": []
110+
},
111+
{
112+
"label": "auth -> analyze",
113+
"type": "shell",
114+
"command": "melos exec -c 1 --scope=\"*auth*\" --fail-fast -- pub global run tuneup check",
115+
"detail": "Run Dart Analyzer on all Auth packages",
116+
"problemMatcher": []
117+
},
118+
{
119+
"label": "auth -> test",
120+
"type": "shell",
121+
"command": "melos exec -c 1 --scope=\"*auth*\" --fail-fast --ignore=\"*web*\" --ignore=\"*example*\" -- flutter test",
122+
"detail": "Run `flutter test` on all Auth packages (excluding web & example)",
123+
"problemMatcher": []
124+
},
125+
{
126+
"label": "auth -> test:e2e",
127+
"type": "shell",
128+
"command": "melos exec -c 1 --scope=\"*firebase_auth_example*\" --fail-fast --dir-exists=test_driver -- flutter drive --no-pub --target=./test_driver/MELOS_PARENT_PACKAGE_NAME_e2e.dart",
129+
"detail": "Run end-to-end testing for Android & iOS via `flutter drive` on the Auth example application",
130+
"problemMatcher": []
131+
},
132+
{
133+
"label": "auth -> test:e2e:web",
134+
"type": "shell",
135+
"command": "melos exec -c 1 --scope=\"*firebase_auth_example*\" --dir-exists=web --fail-fast --dir-exists=test_driver -- flutter drive --release -d chrome --no-pub --verbose-system-logs --browser-name=chrome --target=./test_driver/MELOS_PARENT_PACKAGE_NAME_e2e.dart",
136+
"detail": "Run end-to-end testing for Web via `flutter drive` on the Auth example application",
137+
"problemMatcher": []
138+
},
139+
{
140+
"label": "auth -> test:web",
141+
"type": "shell",
142+
"command": "melos exec -c 1 --scope=\"*firebase_auth_web*\" --fail-fast -- flutter test --platform=chrome",
143+
"detail": "Run `flutter test` on the Auth web package (with '--platform=chrome')",
144+
"problemMatcher": []
145+
},
146+
{
147+
"label": "auth -> build:example:ios",
148+
"type": "shell",
149+
"command": "melos exec -c 1 --scope=\"*firebase_auth_example*\" --fail-fast -- flutter build ios --no-codesign",
150+
"detail": "Build the Auth iOS example application",
151+
"problemMatcher": []
152+
},
153+
{
154+
"label": "auth -> build:example:android",
155+
"type": "shell",
156+
"command": "melos exec -c 1 --scope=\"*firebase_auth_example*\" --fail-fast -- flutter build apk",
157+
"detail": "Build the Auth Android example application",
158+
"problemMatcher": []
159+
},
160+
{
161+
"label": "auth -> build:example:macos",
162+
"type": "shell",
163+
"command": "melos exec -c 1 --scope=\"*firebase_auth_example*\" --fail-fast -- flutter build macos",
164+
"detail": "Build the Auth MacOS example application",
165+
"problemMatcher": []
166+
},
167+
{
168+
"label": "auth -> build:example:web",
169+
"type": "shell",
170+
"command": "melos exec -c 1 --scope=\"*firebase_auth_example*\" --fail-fast -- flutter build web",
171+
"detail": "Build the Auth Web example application",
172+
"problemMatcher": []
110173
}
111174
]
112175
}

docs/migration-guide.mdx

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ The table below shows the recommended minimum versions for each plugin which the
1515
## Breaking Changes & Deprecations
1616

1717
Although breaking changes have been kept to a minimum, the substantial changes and improvements which have been made
18-
required us to break a few things (for the greater good). Where possible, we've deprecated any of the "old ways" of
19-
integrating FlutterFire. You should aim to replace these deprecations as soon as possible.
18+
required us to break a few things (for the greater good). Where possible, we've deprecated some of the "old ways" of
19+
integrating FlutterFire and you should aim to replace these deprecations as soon as possible.
2020

2121
## Migration Steps
2222

@@ -253,4 +253,15 @@ The API has mainly been kept the same, however there are some breaking changes.
253253
- **DEPRECATED**: All sub-class (e.g. `GoogleAuthProvider`) `getCredential()` methods have been deprecated in favor of `credential()`.
254254
- **DEPRECATED**: `EmailAuthProvider.getCredentialWithLink()` has been deprecated in favor of `EmailAuthProvider.credentialWithLink()`.
255255
- **NEW**: Supporting providers can now assign scope and custom request parameters.
256-
- The scope and parameters will be used on web platforms when triggering a redirect or popup via `signInWithPopup()` or `signInWithRedirect()`.
256+
- The scope and parameters will be used on web platforms when triggering a redirect or popup via `signInWithPopup()` or `signInWithRedirect()`.
257+
258+
## Common Upgrade Issues
259+
260+
### CocoaPods could not find compatible versions for pod
261+
262+
This issue can happen when you upgrade your FlutterFire packages and attempt to build for iOS or MacOS, this is usually down to one of the following:
263+
264+
- Your `Podfile.lock` version inside your iOS or MacOS directory is out of date and locked to older versions of the Firebase iOS SDKs whereas the newly upgraded FlutterFire packages might be using newer versions of these SDKs.
265+
- **Solution:** Delete the `Podfile.lock` file and try your build again. This file will get regenerated after the next `pod install`.
266+
- Your pod specs repo is out of date, meanining CocoaPods locally isn't aware of any potential newer versions of the Firebase iOS SDKs that have been recently published.
267+
- **Solution:** Run `pod repo update` in your terminal and try your build again.

docs/sidebars.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ module.exports = {
1919
Analytics: ["analytics/overview", toReferenceAPI("firebase_analytics")],
2020
Authentication: [
2121
"auth/overview",
22-
// "auth/usage",
23-
// "auth/social",
24-
// "auth/phone",
25-
// "auth/error-handling",
22+
"auth/usage",
23+
"auth/social",
24+
"auth/phone",
25+
"auth/error-handling",
2626
toReferenceAPI("firebase_auth"),
2727
],
2828
"Cloud Firestore": [

melos.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ scripts:
8888
rm -rf ./build ./android/.gradle ./ios/.symlinks ./ios/Pods ./android/.idea ./.idea ./.dart-tool/build
8989
9090
dev_dependencies:
91-
pedantic: ^1.8.0
91+
pedantic: 1.8.0
9292

9393
environment:
9494
sdk: ">=2.1.0 <3.0.0"

packages/firebase_auth/analysis_options.yaml

Lines changed: 0 additions & 12 deletions
This file was deleted.

packages/firebase_auth/firebase_auth/CHANGELOG.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,59 @@
1+
## 0.18.0-dev.1
2+
3+
Overall, Firebase Auth has been heavily reworked to bring it inline with the federated plugin setup along with adding new features, documentation and many more unit and end-to-end tests. The API has mainly been kept the same, however there are some breaking changes.
4+
5+
### General
6+
7+
- **BREAKING**: The `FirebaseUser` class has been renamed to `User`.
8+
- **BREAKING**: The `AuthResult` class has been renamed to `UserCredential`.
9+
- **NEW**: The `ActionCodeSettings` class is now consumable on all supporting methods.
10+
- **NEW**: Added support for the `dynamicLinkDomain` property.
11+
- **NEW**: Added a new `FirebaseAuthException` class (extends `FirebaseException`).
12+
- All errors are now returned as a `FirebaseAuthException`, allowing you to access the code & message associated with the error.
13+
- In addition, it is now possible to access the `email` and `credential` properties on exceptions if they exist.
14+
15+
### `FirebaseAuth`
16+
17+
- **BREAKING**: Accessing the current user via `currentUser()` is now synchronous via the `currentUser` getter.
18+
- **BREAKING**: `isSignInWithEmailLink()` is now synchronous.
19+
- **DEPRECATED**: `FirebaseAuth.fromApp()` is now deprecated in favor of `FirebaseAuth.instanceFor()`.
20+
- **DEPRECATED**: `onAuthStateChanged` has been deprecated in favor of `authStateChanges()`.
21+
- **NEW**: Added support for `idTokenChanges()` stream listener.
22+
- **NEW**: Added support for `userChanges()` stream listener.
23+
- The purpose of this API is to allow users to subscribe to all user events without having to manually hydrate app state in cases where a manual reload was required (e.g. `updateProfile()`).
24+
- **NEW**: Added support for `applyActionCode()`.
25+
- **NEW**: Added support for `checkActionCode()`.
26+
- **NEW**: Added support for `verifyPasswordResetCode()`.
27+
- **NEW**: Added support for accessing the current language code via the `languageCode` getter.
28+
- **NEW**: `setLanguageCode()` now supports providing a `null` value.
29+
- On web platforms, if `null` is provided the Firebase projects default language will be set.
30+
- On native platforms, if `null` is provided the device language will be used.
31+
- **NEW**: `verifyPhoneNumber()` exposes a `autoRetrievedSmsCodeForTesting` property.
32+
- This allows developers to test automatic SMS code resolution on Android devices during development.
33+
- **NEW** (iOS): `appVerificationDisabledForTesting` setting can now be set for iOS.
34+
- This allows developers to skip ReCaptcha verification when testing phone authentication.
35+
- **NEW** (iOS): `userAccessGroup` setting can now be set for iOS & MacOS.
36+
- This allows developers to share authentication states across multiple apps or extensions on iOS & MacOS. For more information see the [Firebase iOS SDK documentation](https://firebase.google.com/docs/auth/ios/single-sign-on).
37+
38+
### `User`
39+
40+
- **BREAKING**: Removed the `UpdateUserInfo` class when using `updateProfile` in favor of named arguments.
41+
- **NEW**: Added support for `getIdTokenResult()`.
42+
- **NEW**: Added support for `verifyBeforeUpdateEmail()`.
43+
- **FIX**: Fixed several iOS crashes when the Firebase SDK returned `nil` property values.
44+
- **FIX**: Fixed an issue on Web & iOS where a users email address would still show after unlinking the email/password provider.
45+
46+
### `UserCredential`
47+
48+
- **NEW**: Added support for accessing the users `AuthCredential` via the `credential` property.
49+
50+
### `AuthProvider` & `AuthCredential`
51+
52+
- **DEPRECATED**: All sub-class (e.g. `GoogleAuthProvider`) `getCredential()` methods have been deprecated in favor of `credential()`.
53+
- **DEPRECATED**: `EmailAuthProvider.getCredentialWithLink()` has been deprecated in favor of `EmailAuthProvider.credentialWithLink()`.
54+
- **NEW**: Supporting providers can now assign scope and custom request parameters.
55+
- The scope and parameters will be used on web platforms when triggering a redirect or popup via `signInWithPopup()` or `signInWithRedirect()`.
56+
157
## 0.17.0-dev.2
258

359
* Update plugin and example to use the same core.

0 commit comments

Comments
 (0)