Skip to content

Commit 48fa002

Browse files
committed
Looking for exception reason on reset password
1 parent a77e90f commit 48fa002

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

src/Firebase.Auth/FirebaseAuthProvider.cs

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -278,11 +278,21 @@ public async Task DeleteUserAsync(string firebaseToken)
278278
public async Task SendPasswordResetEmailAsync(string email)
279279
{
280280
var content = $"{{\"requestType\":\"PASSWORD_RESET\",\"email\":\"{email}\"}}";
281-
282-
var response = await this.client.PostAsync(new Uri(string.Format(GoogleGetConfirmationCodeUrl, this.authConfig.ApiKey)), new StringContent(content, Encoding.UTF8, "application/json")).ConfigureAwait(false);
283-
284-
response.EnsureSuccessStatusCode();
285-
}
281+
var responseData = "N/A";
282+
283+
try
284+
{
285+
var response = await this.client.PostAsync(new Uri(string.Format(GoogleGetConfirmationCodeUrl, this.authConfig.ApiKey)), new StringContent(content, Encoding.UTF8, "application/json")).ConfigureAwait(false);
286+
responseData = await response.Content.ReadAsStringAsync().ConfigureAwait(false);
287+
288+
response.EnsureSuccessStatusCode();
289+
}
290+
catch (Exception ex)
291+
{
292+
AuthErrorReason errorReason = GetFailureReason(responseData);
293+
throw new FirebaseAuthException(GoogleGetConfirmationCodeUrl, content, responseData, ex, errorReason);
294+
}
295+
}
286296

287297
/// <summary>
288298
/// Sends user an email with a link to verify his email address.

0 commit comments

Comments
 (0)