RM82
09/09/2024, 12:04 PMrickbutterfield
09/09/2024, 12:08 PMrickbutterfield
09/09/2024, 12:25 PMdiff
public static class MemberAuthenticationExtensions
{
public static IUmbracoBuilder ConfigureAuthenticationMembers(this IUmbracoBuilder builder)
{
- builder.Services.ConfigureOptions<EntraIDB2CMembersExternalLoginProviderOptions>();
- builder.AddMemberExternalLogins(logins =>
- {
builder.Services.ConfigureOptions<EntraIDB2CMembersExternalLoginProviderOptions>();
builder.AddMemberExternalLogins(logins =>
{
logins.AddMemberLogin(
membersAuthenticationBuilder =>
{
...
});
});
- });
return builder;
}
}
RM82
09/09/2024, 12:35 PMRM82
09/10/2024, 10:14 AMjames.bong
09/12/2024, 11:50 AMjames.bong
09/12/2024, 1:43 PMoptions.Events.OnTokenValidated = async context =>
{
var claims = context.Principle?Claims.ToList();
if (claims != null)
{
var email = claims.SingleOrDefault(x => x.Type == "email");
if (email != null)
{
claims.Add(new Claim(ClaimTypes.Email, email.Value));
}
}
context.Principle = new ClaimsPrinciple etc etc
}
Depending on the Azure AD B2C instance, you may have to do something similar with the *name * claim too (this should throw an error though).
With this added, hopefully the login flow will then hit the AutoLink event and the associated Umbraco Member should be created.
Lewis