Skip to content
This repository was archived by the owner on Feb 23, 2025. It is now read-only.

Fill ErrorDescription property for LoginResult #269

Merged
merged 1 commit into from
Dec 8, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 3 additions & 3 deletions src/OidcClient/OidcClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public virtual async Task<LoginResult> LoginAsync(LoginRequest request = null, C

if (authorizeResult.IsError)
{
return new LoginResult(authorizeResult.Error);
return new LoginResult(authorizeResult.Error, authorizeResult.ErrorDescription);
}

var result = await ProcessResponseAsync(
Expand Down Expand Up @@ -182,14 +182,14 @@ public virtual async Task<LoginResult> ProcessResponseAsync(string data, Authori
if (authorizeResponse.IsError)
{
_logger.LogError(authorizeResponse.Error);
return new LoginResult(authorizeResponse.Error);
return new LoginResult(authorizeResponse.Error, authorizeResponse.ErrorDescription);
}

var result = await _processor.ProcessResponseAsync(authorizeResponse, state, extraParameters, cancellationToken);
if (result.IsError)
{
_logger.LogError(result.Error);
return new LoginResult(result.Error);
return new LoginResult(result.Error, result.ErrorDescription);
}

var userInfoClaims = Enumerable.Empty<Claim>();
Expand Down
11 changes: 11 additions & 0 deletions src/OidcClient/Results/LoginResult.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,17 @@ public LoginResult(string error)
Error = error;
}

/// <summary>
/// Initializes a new instance of the <see cref="LoginResult"/> class.
/// </summary>
/// <param name="error">The error.</param>
/// <param name="errorDescription">The error description.</param>
public LoginResult(string error, string errorDescription)
{
Error = error;
ErrorDescription = errorDescription;
}

/// <summary>
/// Gets or sets the user.
/// </summary>
Expand Down