可以和不能使用 B2C 进行身份验证的已注册应用程序之间有什么区别?

What is the Distinction Between Registered Apps That Can And Cannot Authenticate Using B2C?

在我的 Azure AD B2C 目录中注册的某些应用程序在其概览页面上显示此消息:

You can use this application to authenticate against Azure Active Directory, but not Azure AD B2C

很多其他人没有。

由于我的代码将依赖于使用来自这些注册的客户端 ID 的 B2C 身份验证,我需要知道我是否可以 "fix" 这些应用程序注册或者我是否需要创建新的。

这些应用程序有什么区别?是创建它们的方式,还是可以调整设置以允许 B2C 身份验证?

单击消息本身仅链接到 Azure B2C overview page,这不是很具体的帮助。

为了测试这个概念,我使用了 msal 1.1.3 和一个简单的客户端配置。但由于此消息出现在 Azure 门户仪表板上,我认为这不是问题所在:


const msalConfig = {
    auth: {
      clientId: `${MyClientId}`,
      authority: `${MyAuthorityURL}`,
      redirectURI: `${MyRedirect}`
    },
    cache: {
      cacheLocation: "localStorage",
      storeAuthStateInCookie: true
    }
  };

  const msalApplication = new Msal.UserAgentApplication(msalConfig);

B2C 不支持 Daemons/server-side 应用程序、Web API 链(代流)或故障应用程序(即在其他应用程序门户上编辑的应用程序,例如应用程序注册门户;通过 Graph API 编辑的应用程序;或通过 Powershell 编辑的应用程序)。该应用程序是否曾在这些地方之一进行过编辑?如果是这种情况,您将需要删除并重新创建该应用程序。此 document 描述了 B2C 支持和不支持的应用类型。

此外,当然要确保应用程序是在 b2c 中注册的,而不仅仅是在常规 AAD 中注册的。 https://docs.microsoft.com/en-us/azure/active-directory-b2c/tutorial-register-applications?tabs=applications

由于屏幕截图中的消息似乎没有记录在案,因此我已联系产品团队,要求对该消息及其上下文进行更详细的解释。我会尽快更新这个线程。

Since my code will rely on B2C authentication using client ID's from these registrations I need to know whether I can "fix" these application registrations or whether I need to create new ones.

您需要在 Azure AD B2C 下创建新的应用程序。

如果您在 Azure Active Directory 下创建应用程序并在 Azure AD B2C 下打开它,您将看到该警告。

What's the difference between these applications? Is it the way in which they were created, or is it setting(s) that can be adjusted to permit B2C authentication?

一个用于Azure AD,另一个用于Azure AD B2C。是的,这就是它们的创建方式。

我已经在这里回答了这个问题 - microsoft graph rest api beta: application created by api in azure ad b2c is not valid

要使应用程序在 AAD B2C 中成功运行(获取令牌),它具有以下要求

  1. 它需要有一个服务主体

  2. 同意租户中 Microsoft Graph 服务主体的 openid 和 offline_access 范围

    Azure Active Directory 没有这些要求,但 Azure Active Directory B2C 有。

原因是无法在 Azure Active Directory B2C 中向最终用户显示同意体验,而在 Azure Active Directory 中向用户显示。