azure - Microsoft Graph 登录 - 个人帐户触发器 "User account does not exist in tenant"

标签 azure microsoft-graph-api

我的 Web 应用使用 Microsoft Graph API 登录用户并访问他们的日历。我目前在尝试注册 Live/Hotmail 帐户时遇到问题。选择 Live/Hotmail 帐户后,Microsoft 会将用户发送到包含以下消息的页面:

User account '[email protected]' from identity provider 'live.com' does not exist in tenant 'MY_TENANT_NAME' and cannot access the application 'MY_APP_ID'(MY_APP_NAME) in that tenant. The account needs to be added as an external user in the tenant first. Sign out and sign in again with a different Azure Active Directory user account.

我的 Web 应用程序在 Microsoft Azure 中注册为“任何组织目录(任何 Azure AD 目录 - Multi-Tenancy )中的帐户和个人 Microsoft 帐户(例如 Skype、Xbox)”。由于这是我尝试注册的个人帐户,因此我希望它会让我注册。我输入了重定向 URI 和注销 URL,未选中“访问 token ”和“ID token ”,“Live SDK 支持”为"is",“默认客户端类型”为“否”。

我正在使用 Python MSAL 将用户发送到 MS:

def _build_msal_app(cache=None):
    return msal.ConfidentialClientApplication(
        MY_CLIENT_ID, authority=MY_AUTHORITY,
        client_credential=MY_CLIENT_SECRET, token_cache=cache)

# Send user to MS Login
session["state"] = str(uuid.uuid4())
auth_url = _build_msal_app().get_authorization_request_url(
            MY_SCOPES,
            state=session["state"],
            redirect_uri=MY_REDIRECT_URI)

return flask.redirect(auth_url)

我怀疑我的应用程序注册在某种程度上已损坏,因此我注册了第二个应用程序并更新了代码中的 ID,但这并没有解决问题。非常感谢任何帮助!

最佳答案

如评论中所述,为了同时支持“个人 Microsoft”帐户和“工作/学校”帐户,您的授权请求必须发送到 common 端点,即 https:///login.microsoftonline.com/common

您可能会发现此链接有助于理解不同的端点:https://learn.microsoft.com/en-us/azure/active-directory/develop/active-directory-v2-protocols#endpoints .

关于azure - Microsoft Graph 登录 - 个人帐户触发器 "User account does not exist in tenant",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61977669/

相关文章:

Azure Web部署失败

Azure 企业应用程序 : Propagating changes in grants in multi-tenant application

sharepoint - Microsoft Graph API SharePoint 搜索

azure - 如何使用应用程序标识符添加 Azure AD 应用程序

xml - Azure B2C : Where to Create DateTime Extension Attribute to be used in Custom Policy- Portal or Custom Policy or Both?

azure - Azure AD 应用程序客户端 key 的确切规范(允许/禁止的字符)是什么?

Azure Front Door - 在线更改的时间

azure-pipelines.yml 中的 Azure Devops 文件夹结构

azure - v2.0 应用程序缺少 AppCatalog 资源权限

azure-active-directory - dataLocationCode 字段在多地理图形 API 中不可用