恢复 "Access the user's profile" API 访问

Restore "Access the user's profile" API Access

我删除了我的 Azure AD B2C 应用程序中 API 访问权限下的 "Access the user's profile"(可以访问 "openid" 和 "offline_access" 权限),现在我可以'找不到恢复它的方法。我无法删除该应用程序并创建一个新应用程序。

Microsoft 的文档指定它们是默认授予的并且可以删除但他们没有提到如何恢复它们:

By default, applications are granted the ability to access the user's profile via the "openid” permission, and generate refresh tokens via the "offline_access" permission. These can be removed if you do not want your client application to have this functionality.

我该如何恢复?

我为此苦苦挣扎。不幸的是 Microsoft Azure 有一个错误。

但是经过两天的努力,我发现了一个解决方法:

  1. 转到应用程序注册
  2. Select 你的申请
  3. 转到身份验证 -> 重定向 URI
  4. 添加新的 URL(例如 http://localhost:8000

这将在 Azure AD B2C 的 API 访问中重新设置 "Access the user's profile"

现在您可以 select 范围以下;

  • 为用户(openid)获取一个id_token
  • 为用户(offline_access)
  • 获取refresh_token

这将在 API 中添加 "Access the user's profile" 访问 window.

希望对您有所帮助。无需删除现有应用程序。

如本 github issue 中所述,目前无法恢复这些作用域,您必须提交支持请求,以便 Microsoft 手动恢复它们。