active-directory-aspnetcore-webapp-openidconnect-v2 icon indicating copy to clipboard operation
active-directory-aspnetcore-webapp-openidconnect-v2 copied to clipboard

System.string is hidden in Azure AD B2C or PII issue

Open AdityaGupta1409 opened this issue 3 years ago • 4 comments

Screenshot 2022-04-13 162908 This page comes after I click signup/signin button Important links https://aka.ms/IdentityModel/PII Configure authentication in a sample web application by using Azure Active Directory B2C | Microsoft Docs

Please help me with the solution

AdityaGupta1409 avatar Apr 13 '22 11:04 AdityaGupta1409

@AdityaGupta1409 did you enable the PII ?

jmprieur avatar Apr 13 '22 15:04 jmprieur

What is the Instance and the tenant Id that you use in the appsettings.json?

jmprieur avatar Apr 13 '22 15:04 jmprieur

@jmprieur I don't know how to enable PII If you can let me know that would be great.

and my appsettings.json (removed client id for security) { "AzureAdB2C": { "Instance": "https://www.beaconcreate.net/", "ClientId": "", "Domain": "beaconcreate.onmicrosoft.com", "SignedOutCallbackPath": "/signout/B2C_1_beaconcreate", "SignUpSignInPolicyId": "B2C_1_beaconcreate", "ResetPasswordPolicyId": "B2C_1_password_reset", "EditProfilePolicyId": "B2C_1_profile_edit" // Optional profile editing policy //"CallbackPath": "/signin/B2C_1_sign_up_in" // defaults to /signin-oidc }, "Logging": { "LogLevel": { "Default": "Information", "Microsoft": "Warning", "Microsoft.Hosting.Lifetime": "Information" } }, "AllowedHosts": "*" }

or if you can mail me [email protected] I'll send you full code

AdityaGupta1409 avatar Apr 13 '22 17:04 AdityaGupta1409

I'm having the same problem with a new solution

As soon as I add SignUpSignInPolicyId to the config I get the error. Run without SignUpSignInPolicyId .

iguanaware avatar May 14 '22 17:05 iguanaware

@AdityaGupta1409 @iguanaware

A common cause for those errors is trying to access resources that do not exist.

I noticed in the appsettings.json file you have the Instance value set to "https://www.beaconcreate.net/". Do you still encounter this issue when you replace that value with "https://www.beaconcreate.b2clogin.com"?

v-michaelmi avatar Sep 01 '22 00:09 v-michaelmi

Also for reference if you want to see PII

Add the following line of code in Startup.cs in the ConfigureServices method.

Please bare in mind this should be used only for debugging purposes.

        public void ConfigureServices(IServiceCollection services)
        {
            services.Configure<CookiePolicyOptions>(options =>
            {
                // Show PII
                IdentityModelEventSource.ShowPII = true;

                // Rest of code...
            });
            
            // Rest of code...
       }

v-michaelmi avatar Sep 01 '22 00:09 v-michaelmi

No response.

Closing.

Please re-open if issue persists.

v-michaelmi avatar Sep 06 '22 21:09 v-michaelmi

@v-michaelmi This is no longer necessary. If you use the latest Microsoft.Identity.Web, just use the "ShowPII" in the configuration cc: @kalyankrishna1 @aremo-ms

"AzureAd": {
  "ShowPII" : true,
}

jmprieur avatar Sep 07 '22 00:09 jmprieur