Hi,
I realize we can override the AccountAppService
as I mentioned in the original post. This isn't so much a support request but rather a suggestion. The ABP team has developed quite an extensive Extra Properties feature set for extensibility. It's just falling a little short in this use case. It might be useful if in AddOrUpdateProperty
developers could specify whether regular properties should be mapped. Maybe it could be an additional option. This would allow developers to add extra properties to RegisterDto
that could be mapped to normal properties on IdentityUser
and avoid having to completely override AccountAppService
.
Hi,
I'm bringing this one back up because after going through ABP's extensive Extra Properties feature, I still don't see how we can use it to map some obvious properties like Name
and Surname
during registration without modifying module code. In provided AccountAppService.RegisterAsync
the extra properties are mapped like this:
input.MapExtraPropertiesTo(user);
So even after adding Name
and Surname
as extra properties to RegisterDto
those properties will not get mapped to the IdentityUser
object.
Only option to avoid modifying source code seems to be to override the AccountAppService
by calling the base method, map add'l properties after create, and do a follow up UserManager.UpdateAsync
.
public override async Task<IdentityUserDto> RegisterAsync(RegisterDto input)
{
var baseResult = await base.RegisterAsync(input);
// Handle extra properties
var user = await UserManager.GetByIdAsync(baseResult.Id);
user.Surname = input.GetSurname();
user.Name = input.GetName();
await UserManager.UpdateAsync(user);
var result = ObjectMapper.Map<IdentityUser, IdentityUserDto>(user);
return result;
}
It would be nice if there was a way to make MapExtraPropertiesTo
extension method also map to regular properties. After checking the source, it seems that this is only possible using AutoMapper MapExtraProperties
which would still require modifying module source code.
Thoughts?
Hi,
Following up on this, possibly the "right" way to do this might be to add another Identity Server extension grant to exchange an external login token for a ID4 token:
https://identityserver4.readthedocs.io/en/latest/quickstarts/community.html?highlight=external#exchanging-external-tokens-from-facebook-google-and-twitter
Does the ABP team have thoughts on this or is another approach recommended?
Hi,
Yes that's the part we're trying to figure out. In a mobile app I'd like to stick with client-side social login without transferring to the API UI. In ASP.NET Zero there was an ExternalAuthenticate endpoint that was called by Angular but i don't see that in abp.io
Hi,
I should've specified a little more. We've been trying to follow the flow of Angular solution. At some point it looks like a redirect to the ASPNET Core app happens and there is logic to display a register screen if the user is new. Would we try to do the same in RN? Basically looking for guidance on what endpoints to call to auto register the user in ABP.
Thanks!