Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

Account provisioned by means of MicrosoftAuthProviderApi results in "FirstName LastName" placed in the "FirstName" field #10641


User avatar
0
hra created

Prerequisites

AspNetZero 10

We are using Microsoft Authentication, and have noticed that after a user has provisioned their account using "Sign in with Microsoft", their name appears as: "John Smith Smith" - because their first and last names are squeezed into the AbpUser.FirstName in addition to their last name being placed in Abpuser.Surname.

After recently being given a code sample, we can now see why: in MicrosoftAuthProviderApi is the following code:

            var result = new ExternalAuthUserInfo
            {
                Name = MicrosoftAccountHelper.GetDisplayName(payload),
                EmailAddress = MicrosoftAccountHelper.GetEmail(payload),
                Surname = MicrosoftAccountHelper.GetSurname(payload),
                Provider = Name,
                ProviderKey = MicrosoftAccountHelper.GetId(payload)
            };

I believe It should be

            var result = new ExternalAuthUserInfo
            {
                Name = MicrosoftAccountHelper.GetGivenName(payload),
                EmailAddress = MicrosoftAccountHelper.GetEmail(payload),
                Surname = MicrosoftAccountHelper.GetSurname(payload),
                Provider = Name,
                ProviderKey = MicrosoftAccountHelper.GetId(payload)
            };

2 Answer(s)