Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
79 commits
Select commit Hold shift + click to select a range
ce9e8cf
feat(auth): move to Pigeon for Platform channels
Lyokone Apr 17, 2023
7e8b5f9
feat(auth): move to Pigeon for Platform channels
Lyokone Apr 20, 2023
17ce2af
feat(auth): move to Pigeon for Platform channels
Lyokone Apr 20, 2023
d8a4ab2
feat(auth): move to Pigeon for Platform channels
Lyokone Apr 20, 2023
eb0d9bd
feat(auth): move to Pigeon for Platform channels
Lyokone Apr 20, 2023
fb53ffc
feat(auth): move to Pigeon for Platform channels
Lyokone Apr 20, 2023
5bb2b0c
feat(auth): move to Pigeon for Platform channels
Lyokone Apr 20, 2023
10735d5
feat(auth): move to Pigeon for Platform channels
Lyokone Apr 20, 2023
19f9125
feat(auth): move to Pigeon for Platform channels
Lyokone Apr 20, 2023
187cf8d
feat(auth): move to Pigeon for Platform channels
Lyokone Apr 20, 2023
5aa7dd2
feat(auth): move to Pigeon for Platform channels
Lyokone Apr 20, 2023
5ceed08
feat(auth): move to Pigeon for Platform channels
Lyokone Apr 21, 2023
cecb05c
feat(auth): move to Pigeon for Platform channels
Lyokone Apr 21, 2023
77470c2
feat(auth): move to Pigeon for Platform channels
Lyokone Apr 21, 2023
456c2f9
feat(auth): move to Pigeon for Platform channels
Lyokone Apr 21, 2023
5c9fb61
feat(auth): move to Pigeon for Platform channels END Auth
Lyokone Apr 21, 2023
1855736
feat(auth): move to Pigeon for Platform channels START user
Lyokone Apr 21, 2023
fed08b6
feat(auth): move to Pigeon for Platform channels
Lyokone Apr 21, 2023
27a99a2
feat(auth): move to Pigeon for Platform channels
Lyokone Apr 21, 2023
a67334e
feat(auth): move to Pigeon for Platform channels
Lyokone Apr 21, 2023
50a0493
feat(auth): move to Pigeon for Platform channels
Lyokone Apr 21, 2023
ee79965
feat(auth): move to Pigeon for Platform channels
Lyokone Apr 21, 2023
e606958
feat(auth): move to Pigeon for Platform channels
Lyokone Apr 24, 2023
73cd3f2
feat(auth): move to Pigeon for Platform channels
Lyokone Apr 24, 2023
e9663ce
feat(auth): move to Pigeon for Platform channels
Lyokone Apr 24, 2023
277b3e8
feat(auth): move to Pigeon for Platform channels
Lyokone Apr 24, 2023
861abd1
feat(auth): move to Pigeon for Platform channels
Lyokone Apr 24, 2023
12ad2bd
feat(auth): move to Pigeon for Platform channels
Lyokone Apr 24, 2023
6d63edb
feat: start objc
Lyokone Apr 27, 2023
daf53c0
feat: ios
Lyokone May 2, 2023
332cb5a
feat: ios
Lyokone May 2, 2023
6e94847
feat: ios
Lyokone May 2, 2023
579d062
feat: ios
Lyokone May 2, 2023
55942ae
feat: ios
Lyokone May 3, 2023
1dfc864
feat: ios
Lyokone May 3, 2023
a0c5b7e
feat: ios
Lyokone May 3, 2023
4c875e6
feat: ios
Lyokone May 4, 2023
90aeae4
feat: ios
Lyokone May 4, 2023
3e0548f
feat: ios
Lyokone May 9, 2023
52d4488
feat: ios done
Lyokone May 9, 2023
bbc6df0
feat: ios done
Lyokone May 9, 2023
3c32439
merge master
Lyokone May 9, 2023
5e92bba
remove test code from demo
Lyokone May 9, 2023
c1c62a8
fix codes
Lyokone May 10, 2023
dab3992
fix codes
Lyokone May 10, 2023
15dbbcc
fix codes
Lyokone May 10, 2023
983dfe4
feat: update web
Lyokone May 11, 2023
fc4e6ac
feat: update tests
Lyokone May 11, 2023
d98fe76
Merge branch 'master' into feat/pigeon-auth
Lyokone May 15, 2023
c88de08
fix tests
Lyokone May 16, 2023
aff9125
Merge branch 'master' of https://github.com/firebase/flutterfire into…
Lyokone May 17, 2023
993073d
add licence
Lyokone May 17, 2023
616370e
fix analyze
Lyokone May 17, 2023
66af294
fix analyze
Lyokone May 17, 2023
76a88da
fix pod projects
Lyokone May 17, 2023
05c57ba
fix macos
Lyokone May 17, 2023
5fb6ff5
fix macos
Lyokone May 17, 2023
d43ea95
fix format
Lyokone May 17, 2023
a1fae45
fix ci
Lyokone May 17, 2023
0b72b60
remove useless file
Lyokone May 17, 2023
9aa06d6
fix ios crash
Lyokone May 17, 2023
8e0dded
swift 5.6
Lyokone May 17, 2023
7e239f1
fix tests
Lyokone May 22, 2023
c63cbed
fix tests
Lyokone May 22, 2023
2210890
fix tests
Lyokone May 22, 2023
4b460d9
fix tests
Lyokone May 22, 2023
2f8fd85
fix tests
Lyokone May 22, 2023
ae5dbad
fix ci
Lyokone May 22, 2023
7d2b1c9
fix ci
Lyokone May 22, 2023
719a21d
fix android
Lyokone May 23, 2023
1b5ed85
fix format
Lyokone May 23, 2023
a83fba5
fix format
Lyokone May 23, 2023
5311882
XL runner??
Lyokone May 23, 2023
785bc31
Merge branch 'master' of https://github.com/firebase/flutterfire into…
Lyokone May 23, 2023
02d7b5e
Update packages/firebase_auth/firebase_auth/android/src/main/java/io/…
Lyokone Jun 5, 2023
6b9d984
Update packages/firebase_auth/firebase_auth/ios/Classes/FLTFirebaseAu…
Lyokone Jun 5, 2023
887cc72
remove useless code and apply suggestions from review
Lyokone Jun 6, 2023
6894958
remove useless code and apply suggestions from review
Lyokone Jun 6, 2023
923811a
Merge remote-tracking branch 'origin/master' into feat/pigeon-auth
Lyokone Jul 10, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat: update web
  • Loading branch information
Lyokone committed May 11, 2023
commit 983dfe4881e86f66645ba0dda41b9db05c3a5427
54 changes: 54 additions & 0 deletions packages/firebase_auth/firebase_auth/lib/src/firebase_auth.dart
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,47 @@ class FirebaseAuth extends FirebasePluginPlatform {
return null;
}

/// Changes this instance to point to an Auth emulator running locally.
///
/// Set the [origin] of the local emulator, such as "http://localhost:9099"
///
/// Note: Must be called immediately, prior to accessing auth methods.
/// Do not use with production credentials as emulator traffic is not encrypted.
///
/// Note: auth emulator is not supported for web yet. firebase-js-sdk does not support
/// auth.useEmulator until v8.2.4, but FlutterFire does not support firebase-js-sdk v8+ yet
@Deprecated(
'Will be removed in future release. '
'Use useAuthEmulator().',
)
Future<void> useEmulator(String origin) async {
assert(origin.isNotEmpty);
String mappedOrigin = origin;

// Android considers localhost as 10.0.2.2 - automatically handle this for users.
if (defaultTargetPlatform == TargetPlatform.android && !kIsWeb) {
if (mappedOrigin.startsWith('http://localhost')) {
mappedOrigin =
mappedOrigin.replaceFirst('http://localhost', 'http://10.0.2.2');
} else if (mappedOrigin.startsWith('http://127.0.0.1')) {
mappedOrigin =
mappedOrigin.replaceFirst('http://127.0.0.1', 'http://10.0.2.2');
}
}

// Native calls take the host and port split out
final hostPortRegex = RegExp(r'^http:\/\/([\w\d.]+):(\d+)$');
final RegExpMatch? match = hostPortRegex.firstMatch(mappedOrigin);
if (match == null) {
throw ArgumentError('firebase.auth().useEmulator() origin format error');
}
// Two non-empty groups in RegExp match - which is null-tested - these are non-null now
final String host = match.group(1)!;
final int port = int.parse(match.group(2)!);

await useAuthEmulator(host, port);
}

/// Changes this instance to point to an Auth emulator running locally.
///
/// Set the [host] of the local emulator, such as "localhost"
Expand Down Expand Up @@ -581,6 +622,19 @@ class FirebaseAuth extends FirebasePluginPlatform {
}
}

/// Signs in with an AuthProvider using native authentication flow. This is
/// deprecated in favor of `signInWithProvider()`.
///
/// A [FirebaseAuthException] maybe thrown with the following error code:
/// - **user-disabled**:
/// - Thrown if the user corresponding to the given email has been disabled.
@Deprecated('You should use signInWithProvider instead')
Future<UserCredential> signInWithAuthProvider(
AuthProvider provider,
) async {
return signInWithProvider(provider);
}

/// Signs in with an AuthProvider using native authentication flow.
///
/// A [FirebaseAuthException] maybe thrown with the following error code:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ export 'src/auth_provider.dart';
export 'src/firebase_auth_exception.dart';
export 'src/firebase_auth_multi_factor_exception.dart';
export 'src/id_token_result.dart';
export 'src/pigeon/messages.pigeon.dart'
show
PigeonUserDetails,
PigeonUserInfo,
ActionCodeInfoOperation,
PigeonIdTokenResult;
export 'src/platform_interface/platform_interface_confirmation_result.dart';
export 'src/platform_interface/platform_interface_firebase_auth.dart';
export 'src/platform_interface/platform_interface_multi_factor.dart';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ class FirebaseAuthWeb extends FirebaseAuthPlatform {

@override
FirebaseAuthWeb setInitialValues({
Map<String, dynamic>? currentUser,
PigeonUserDetails? currentUser,
String? languageCode,
}) {
// Values are already set on web
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,39 +24,42 @@ class UserWeb extends UserPlatform {
MultiFactorPlatform multiFactor,
this._webUser,
this._webAuth,
) : super(auth, multiFactor, {
'displayName': _webUser.displayName,
'email': _webUser.email,
'emailVerified': _webUser.emailVerified,
'isAnonymous': _webUser.isAnonymous,
'metadata': <String, int?>{
'creationTime': _webUser.metadata.creationTime != null
? _dateFormat
.parse(_webUser.metadata.creationTime!, true)
.millisecondsSinceEpoch
: null,
'lastSignInTime': _webUser.metadata.lastSignInTime != null
? _dateFormat
.parse(_webUser.metadata.lastSignInTime!, true)
.millisecondsSinceEpoch
: null,
},
'phoneNumber': _webUser.phoneNumber,
'photoURL': _webUser.photoURL,
'providerData': _webUser.providerData
.map((auth_interop.UserInfo webUserInfo) => <String, dynamic>{
'displayName': webUserInfo.displayName,
'email': webUserInfo.email,
'phoneNumber': webUserInfo.phoneNumber,
'providerId': webUserInfo.providerId,
'photoURL': webUserInfo.photoURL,
'uid': webUserInfo.uid,
})
.toList(),
'refreshToken': _webUser.refreshToken,
'tenantId': _webUser.tenantId,
'uid': _webUser.uid,
});
) : super(
auth,
multiFactor,
PigeonUserDetails(
userInfo: PigeonUserInfo(
displayName: _webUser.displayName,
email: _webUser.email,
isEmailVerified: _webUser.emailVerified,
isAnonymous: _webUser.isAnonymous,
creationTimestamp: _webUser.metadata.creationTime != null
? _dateFormat
.parse(_webUser.metadata.creationTime!, true)
.millisecondsSinceEpoch
: null,
lastSignInTimestamp: _webUser.metadata.lastSignInTime != null
? _dateFormat
.parse(_webUser.metadata.lastSignInTime!, true)
.millisecondsSinceEpoch
: null,
phoneNumber: _webUser.phoneNumber,
photoUrl: _webUser.photoURL,
refreshToken: _webUser.refreshToken,
tenantId: _webUser.tenantId,
uid: _webUser.uid,
),
providerData: _webUser.providerData
.map((auth_interop.UserInfo webUserInfo) => <String, dynamic>{
'displayName': webUserInfo.displayName,
'email': webUserInfo.email,
'phoneNumber': webUserInfo.phoneNumber,
'providerId': webUserInfo.providerId,
'photoUrl': webUserInfo.photoURL,
'uid': webUserInfo.uid,
})
.toList()),
);

final auth_interop.User _webUser;
final auth_interop.Auth? _webAuth;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,13 @@ ActionCodeInfo? convertWebActionCodeInfo(
return null;
}

return ActionCodeInfo(operation: 0, data: <String, dynamic>{
'email': webActionCodeInfo.data.email,
'previousEmail': webActionCodeInfo.data.previousEmail,
});
return ActionCodeInfo(
operation: ActionCodeInfoOperation.passwordReset,
data: ActionCodeInfoData(
email: webActionCodeInfo.data.email,
previousEmail: webActionCodeInfo.data.previousEmail,
),
);
}

/// Converts a [auth_interop.AdditionalUserInfo] into a [AdditionalUserInfo].
Expand All @@ -127,16 +130,17 @@ AdditionalUserInfo? convertWebAdditionalUserInfo(
IdTokenResult convertWebIdTokenResult(
auth_interop.IdTokenResult webIdTokenResult,
) {
return IdTokenResult(<String, dynamic>{
'claims': webIdTokenResult.claims,
'expirationTimestamp':
webIdTokenResult.expirationTime.millisecondsSinceEpoch,
'issuedAtTimestamp': webIdTokenResult.issuedAtTime.millisecondsSinceEpoch,
'authTimestamp': webIdTokenResult.authTime.millisecondsSinceEpoch,
'signInProvider': webIdTokenResult.signInProvider,
'signInSecondFactor': null,
'token': webIdTokenResult.token,
});
return IdTokenResult(
PigeonIdTokenResult(
claims: webIdTokenResult.claims,
token: webIdTokenResult.token,
authTimestamp: webIdTokenResult.authTime.millisecondsSinceEpoch,
issuedAtTimestamp: webIdTokenResult.issuedAtTime.millisecondsSinceEpoch,
expirationTimestamp:
webIdTokenResult.expirationTime.millisecondsSinceEpoch,
signInProvider: webIdTokenResult.signInProvider,
),
);
}

/// Converts a [ActionCodeSettings] into a [auth_interop.ActionCodeSettings].
Expand Down