@@ -83,10 +83,16 @@ class User extends UserInfo<firebase_interop.UserJsImpl> {
83
83
Future <String > getToken ([bool forceRefresh = false ]) =>
84
84
handleThenable (jsObject.getToken (forceRefresh));
85
85
86
- /// Links the user account with the given [credential] and returns the user.
86
+ /// _Deprecated: Use [linkWithCredential] instead._
87
+ @deprecated
87
88
Future <User > link (AuthCredential credential) => handleThenableWithMapper (
88
89
jsObject.link (credential), (u) => new User .fromJsObject (u));
89
90
91
+ /// Links the user account with the given [credential] and returns the user.
92
+ Future <User > linkWithCredential (AuthCredential credential) =>
93
+ handleThenableWithMapper (jsObject.linkWithCredential (credential),
94
+ (u) => new User .fromJsObject (u));
95
+
90
96
/// Links the authenticated [provider] to the user account using
91
97
/// a pop-up based OAuth flow.
92
98
/// It returns the [UserCredential] information if linking is successful.
@@ -99,11 +105,29 @@ class User extends UserInfo<firebase_interop.UserJsImpl> {
99
105
Future linkWithRedirect (AuthProvider provider) =>
100
106
handleThenable (jsObject.linkWithRedirect (provider.jsObject));
101
107
108
+ /// _Deprecated: Use [reauthenticateWithCredential] instead._
109
+ @deprecated
110
+ Future reauthenticate (AuthCredential credential) =>
111
+ handleThenable (jsObject.reauthenticate (credential));
112
+
102
113
/// Re-authenticates a user using a fresh [credential] . Should be used
103
114
/// before operations such as [updatePassword()] that require tokens
104
115
/// from recent sign in attempts.
105
- Future reauthenticate (AuthCredential credential) =>
106
- handleThenable (jsObject.reauthenticate (credential));
116
+ Future reauthenticateWithCredential (AuthCredential credential) =>
117
+ handleThenable (jsObject.reauthenticateWithCredential (credential));
118
+
119
+ /// Reauthenticates a user with the specified provider using
120
+ /// a pop-up based OAuth flow.
121
+ /// It returns the [UserCredential] information if reauthentication is successful.
122
+ Future <UserCredential > reauthenticateWithPopup (AuthProvider provider) =>
123
+ handleThenableWithMapper (
124
+ jsObject.reauthenticateWithPopup (provider.jsObject),
125
+ (u) => new UserCredential .fromJsObject (u));
126
+
127
+ /// Reauthenticates a user with the specified OAuth [provider] using
128
+ /// a full-page redirect flow.
129
+ Future reauthenticateWithRedirect (AuthProvider provider) =>
130
+ handleThenable (jsObject.reauthenticateWithRedirect (provider.jsObject));
107
131
108
132
/// If signed in, it refreshes the current user.
109
133
Future reload () => handleThenable (jsObject.reload ());
@@ -468,7 +492,9 @@ class AuthEvent {
468
492
AuthEvent (this .user);
469
493
}
470
494
471
- /// A structure containing [User] and [AuthCredential] .
495
+ /// A structure containing a [User] , an [AuthCredential] and [operationType] .
496
+ /// operationType could be 'signIn' for a sign-in operation, 'link' for a
497
+ /// linking operation and 'reauthenticate' for a reauthentication operation.
472
498
class UserCredential extends JsObjectWrapper <UserCredentialJsImpl > {
473
499
User _user;
474
500
@@ -500,10 +526,22 @@ class UserCredential extends JsObjectWrapper<UserCredentialJsImpl> {
500
526
jsObject.credential = c;
501
527
}
502
528
503
- /// Creates a new UserCredential with optional [user] and [credential] .
504
- factory UserCredential ({User user, AuthCredential credential}) =>
529
+ /// Returns the operation type.
530
+ String get operationType => jsObject.operationType;
531
+
532
+ /// Sets the operation type to [t] .
533
+ void set operationType (String t) {
534
+ jsObject.operationType = t;
535
+ }
536
+
537
+ /// Creates a new UserCredential with optional [user] , [credential]
538
+ /// and [operationType] .
539
+ factory UserCredential (
540
+ {User user, AuthCredential credential, String operationType}) =>
505
541
new UserCredential .fromJsObject (new UserCredentialJsImpl (
506
- user: user.jsObject, credential: credential));
542
+ user: user.jsObject,
543
+ credential: credential,
544
+ operationType: operationType));
507
545
508
546
/// Creates a new UserCredential from a [jsObject] .
509
547
UserCredential .fromJsObject (UserCredentialJsImpl jsObject)
0 commit comments