MSAL的MSAL身份验证B2C显示黑屏

发布于 2025-01-22 05:44:27 字数 847 浏览 0 评论 0原文

I am working with the .NET MAUI starter project (calling it AuthTest) and adding the changes from

该代码可以在AcquireTokenInteractive调用中正常工作,然后使用黑屏幕坐着(大概等待B2C进程完成)...没有错误消息或任何所需的指示。

停止的代码是:

public async Task<AuthenticationResult> LoginAsync(CancellationToken cancellationToken) {
            AuthenticationResult result;
            try {
                result = await _authClient
                .AcquireTokenInteractive(_constants.Scopes)
                .WithPrompt(Prompt.ForceLogin)
#if ANDROID
                .WithParentActivityOrWindow(Platform.CurrentActivity)
#endif
                .ExecuteAsync(cancellationToken);
                return result;
            }
            catch(MsalClientException) { return null; }
        }

它永远不会达到返回结果;

有人看到了这一点并有一些建议可以尝试吗?

I am working with the .NET MAUI starter project (calling it AuthTest) and adding the changes from this article, but when the android emulator tries to start the B2C process all I get back is black screen that just sits until the system gives me the 'AuthTest isn't responding' message. HAs anyone seen this and know what causes it?

The code works fine up to the AcquireTokenInteractive call and then just sits (presumably waiting for the B2C process to complete) with a black screen...no error message or any indication what it is looking for.

The code that stops at is:

public async Task<AuthenticationResult> LoginAsync(CancellationToken cancellationToken) {
            AuthenticationResult result;
            try {
                result = await _authClient
                .AcquireTokenInteractive(_constants.Scopes)
                .WithPrompt(Prompt.ForceLogin)
#if ANDROID
                .WithParentActivityOrWindow(Platform.CurrentActivity)
#endif
                .ExecuteAsync(cancellationToken);
                return result;
            }
            catch(MsalClientException) { return null; }
        }

It just never reaches the return result;

Has anyone seen this and have some suggestions to try?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

她说她爱他 2025-01-29 05:44:27

对于任何尝试与上面相同的事情的人,我发现本文有效。我尚未将其与上面的一个进行比较以找到差异,但是链接的文章中的示例代码(在此答案中)允许MAUI应用程序登录AAD B2C租户。

For anyone trying the same thing as above, I have found that this article works. I have not yet compared this to the one above to find the differences, but the sample code from the linked article (in this answer) allows a MAUI application to login against AAD B2C tenant.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文