Skip to content

Show errors in the log from VerifyUserTokenAsync #5826

Description

@LindaLawton

I am getting a nice warning in my logs when the code is invalid from L1712

warn: Microsoft.AspNetCore.Identity.UserManager[9]
VerifyUserTokenAsync() failed with purpose: ResetPassword for user 21248592.

However it does not tell me what the error is in the error message is. I have had to add this in my own code.

dbug:IdentityServer.Controllers.Account.AccountController[2150]
User invite failed for [User: 21248592] [error: Invalid token.]

Which basically means i have two log entries for the same issue. It would be nice to get a list of the errors from the result into the warning message.

Can i suggest something like this? I would be happy to submit a pull request if you like

if (!result)
            {
               var errors = string.Join(", ", result.Errors.Select(a => a.Description));
                Logger.LogWarning(9, "VerifyUserTokenAsync() failed with purpose: {purpose} for user {userId}. 
 Errors {errors }", purpose, await GetUserIdAsync(user), errors );
            }

Metadata

Metadata

Assignees

Labels

DoneThis issue has been fixedarea-identityIncludes: Identity and providersenhancementThis issue represents an ask for new feature or an enhancement to an existing one

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions