File tree Expand file tree Collapse file tree 3 files changed +28
-4
lines changed
Expand file tree Collapse file tree 3 files changed +28
-4
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,8 @@ import 'auth/auth_api_request.dart';
88import 'auth/user_record.dart' ;
99import 'service.dart' ;
1010
11+ export 'auth/user_record.dart' ;
12+
1113/// The Firebase Auth service interface.
1214class Auth implements FirebaseService {
1315 @override
@@ -35,6 +37,15 @@ class Auth implements FirebaseService {
3537 return UserRecord .fromJson (response['users' ][0 ]);
3638 }
3739
40+ /// Gets the user data for the users corresponding to the given [uids] .
41+ Future <List <UserRecord >> getUsers (List <String > uids) async {
42+ var response = await _authRequestHandler.getAccountInfoByUids (uids);
43+ // Returns the user record populated with server response.
44+ return (response['users' ] as List )
45+ .map ((u) => UserRecord .fromJson (u))
46+ .toList ();
47+ }
48+
3849 /// Looks up the user identified by the provided email and returns a future
3950 /// that is fulfilled with a user record for the given user if that user is
4051 /// found.
Original file line number Diff line number Diff line change @@ -87,6 +87,16 @@ class AuthRequestHandler {
8787 });
8888 }
8989
90+ /// Looks up users by their uids.
91+ Future <Map <String , dynamic >> getAccountInfoByUids (List <String > uids) async {
92+ if (uids.any ((uid) => ! validator.isUid (uid))) {
93+ throw FirebaseAuthError .invalidUid ();
94+ }
95+ return _getAccountInfo ({
96+ 'localId' : uids,
97+ });
98+ }
99+
90100 /// Looks up a user by email.
91101 Future <Map <String , dynamic >> getAccountInfoByEmail (String email) async {
92102 if (! validator.isEmail (email)) {
@@ -473,7 +483,10 @@ class CreateEditAccountRequest {
473483 // deleteProvider: ['phone'] with an array of providerIds (phone in this case),
474484 // will be passed.
475485 // Currently this applies to phone provider only.
476- if (phoneNumber == '' ) 'deleteProvider' : ['phone' ],
486+ if (phoneNumber == '' )
487+ 'deleteProvider' : ['phone' ],
488+ if (customAttributes != null )
489+ 'customAttributes' : customAttributes,
477490 if (validSince != null )
478491 'validSince' : validSince! .millisecondsSinceEpoch ~ / 1000
479492 };
Original file line number Diff line number Diff line change @@ -15,14 +15,14 @@ class UserMetadata {
1515 ? null
1616 : DateTime .fromMillisecondsSinceEpoch (
1717 int .parse (map['createdAt' ])),
18- lastSignInTime: map['lastSignInTime ' ] == null
18+ lastSignInTime: map['lastLoginAt ' ] == null
1919 ? null
2020 : DateTime .fromMillisecondsSinceEpoch (
21- int .parse (map['lastSignInTime ' ])));
21+ int .parse (map['lastLoginAt ' ])));
2222
2323 Map <String , dynamic > toJson () {
2424 return {
25- 'lastSignInTime ' : lastSignInTime? .toIso8601String (),
25+ 'lastLoginAt ' : lastSignInTime? .toIso8601String (),
2626 'creationTime' : creationTime? .toIso8601String (),
2727 };
2828 }
You can’t perform that action at this time.
0 commit comments