Skip to content

Commit 3d5ea59

Browse files
authored
Add new Auth APIs using AuthResult (#703)
Properly implement `AuthResult` and add the following methods which returns `Task<AuthResult>` - `FirebaseAuth.SignInWithCustomTokenAsync()` - `FirebaseAuth.SignInWithCredentialAsync()` - `FirebaseAuth.SignInWithProviderAsync()` - `FirebaseAuth.SignInAndRetrieveDataWithCredentialAsync()` - `FirebaseAuth.SignInAnonymouslyAsync()` - `FirebaseAuth.SignInWithEmailAndPasswordAsync()` - `FirebaseAuth.CreateUserWithEmailAndPasswordAsync()` - `FirebaseUser.ReauthenticateAndRetrieveDataAsync()` - `FirebaseUser.ReauthenticateWithProviderAsync()` - `FirebaseUser.LinkWithCredentialAsync()` - `FirebaseUser.LinkWithProviderAsync()` - `FirebaseUser.UnlinkAsync()` - `FirebaseUser.UpdatePhoneNumberCredentialAsync()` Misc - Remove `SignInWithCredentialInternalAsync_DEPRECATED()` and rewire `SignInWithCredentialInternalAsync()` to the version returning `Future<User>` instead.
1 parent d262d3c commit 3d5ea59

File tree

2 files changed

+428
-17
lines changed

2 files changed

+428
-17
lines changed

auth/src/FirebaseAccountLinkException.cs

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,21 @@ public sealed class FirebaseAccountLinkException : System.Exception
2626
{
2727
/// Initializes a new FirebaseAccountLinkException, with the given error code and
2828
/// message and the AdditionalUserInfo returned from the Firebase auth service.
29+
[System.Obsolete("Use `FirebaseAccountLinkException(int, string, AuthResult)` instead", false)]
2930
public FirebaseAccountLinkException(int errorCode, string message,
3031
SignInResult signInResult) : base(message)
3132
{
3233
ErrorCode = errorCode;
33-
Result = signInResult;
34+
result_DEPRECATED = signInResult;
35+
}
36+
37+
/// Initializes a new FirebaseAccountLinkException, with the given error code and
38+
/// message and the AdditionalUserInfo returned from the Firebase auth service.
39+
public FirebaseAccountLinkException(int errorCode, string message,
40+
AuthResult authResult) : base(message)
41+
{
42+
ErrorCode = errorCode;
43+
result = authResult;
3444
}
3545

3646
/// Returns the Auth defined non-zero error code.
@@ -43,10 +53,12 @@ public FirebaseAccountLinkException(int errorCode, string message,
4353
/// the credential may be used to sign-in the user into Firebase with
4454
/// Firebase.Auth.SignInWithCredentialAsync.
4555
public AdditionalUserInfo UserInfo {
46-
get { return Result.Info; }
56+
get { return (result != null) ? result.AdditionalUserInfoInternal :
57+
(result_DEPRECATED != null) ? result_DEPRECATED.Info : null; }
4758
}
4859

49-
private SignInResult Result { get; set; }
60+
private SignInResult result_DEPRECATED = null;
61+
private AuthResult result = null;
5062
}
5163

5264
}

0 commit comments

Comments
 (0)