Azure-Samples / Azure-Samples/active-directory-b2c-dotnet-webapp-and-webapi

Is this sample, as it is, still functional?

Open
#175 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
282
Forks
236
PR merge metrics
No merged PRs in 30d

Description

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:

```csharp
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!

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.