Azure MSAL JS: How to edit profile? Azure MSAL JS: How to edit profile? azure azure

Azure MSAL JS: How to edit profile?


Yes, this is correct. You will need to use a different authority which URL is composed of the tenant and the policy name, as shown here:

private static string Tenant = "yourTenant.onmicrosoft.com";public static string PolicySignUpSignIn = "b2c_1_susi";public static string PolicyEditProfile = "b2c_1_edit_profile";private static string BaseAuthority = "https://login.microsoftonline.com/tfp/{tenant}/{policy}/oauth2/v2.0/authorize";public static string Authority = BaseAuthority.Replace("{tenant}", Tenant).Replace("{policy}", PolicySignUpSignIn);public static string AuthorityEditProfile = BaseAuthority.Replace("{tenant}", Tenant).Replace("{policy}", PolicyEditProfile);

BTW, that sample, although for .NET Desktop shows how to use the edit profile and password reset policies: active-directory-b2c-dotnet-desktop , see in particular the EditProfileButton_Click method, the factor of acquiring the token (interactively) will trigger the dialog to edit the profile:

AuthenticationResult authResult = await App.PublicClientApp.AcquireTokenAsync(App.ApiScopes, GetUserByPolicy(App.PublicClientApp.Users, App.PolicyEditProfile), UIBehavior.SelectAccount, string.Empty, null, App.AuthorityEditProfile);