Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is this sample, as it is, still functional? #175

Open
dieggoesteban opened this issue Jul 15, 2024 · 0 comments
Open

Is this sample, as it is, still functional? #175

dieggoesteban opened this issue Jul 15, 2024 · 0 comments

Comments

@dieggoesteban
Copy link

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant