active-directory-b2c-dotnet-webapp-and-webapi
active-directory-b2c-dotnet-webapp-and-webapi copied to clipboard
Is this sample, as it is, still functional?
Hello everyone!
We are migrating our WebApp and WebAPI to AAD B2C. Our projects are .NET Framework based so I think this example is the closest one to our use case.
I wonder if this sample in the repo is still usable and worth the time to make it work because I've been struggling the last few days. I couldn't find a newer example on how to implement AAD B2C with .Net Framework.
I'm new to Azure in general and I was reading a lot of documentation but I couldn't make this sample to work. First problem was in this section inside TasksController.cs:
IConfidentialClientApplication cca = MsalAppBuilder.BuildConfidentialClientApplication();
string accountId = ClaimsPrincipal.Current.GetB2CMsalAccountIdentifier(Globals.SignUpSignInPolicyId);
var account = await cca.GetAccountAsync(accountId);
return await cca.AcquireTokenSilent(scopes, account).ExecuteAsync();
GetAccountAsync always returns null. I tried using GetAccountsAsync (it's deprecated) and it returns null also.
In this #109 issue the solution was to lower the policy id but it didn't work for me.
Thanks in advance!