【问题标题】:Azure AD token obtaining for guest为来宾获取 Azure AD 令牌
【发布时间】:2019-09-15 23:33:42
【问题描述】:

在我在 Azure 上注册的 Web API 应用程序中,我通过这种方式为 Active Directory 中的用户获取令牌:

    var result = await client.PostAsync(oauthEndpoint, new FormUrlEncodedContent(new[]
    {
        new KeyValuePair<string, string>("client_id", _azureOptions.ClientId),
        new KeyValuePair<string, string>("grant_type", "password"),
        new KeyValuePair<string, string>("username", userName),
        new KeyValuePair<string, string>("password", password),
        new KeyValuePair<string, string>("client_secret", _azureOptions.ClientSecret),
        new KeyValuePair<string, string>("client_info", "1"),
        new KeyValuePair<string, string>("scope",
                                    "openid offline_access profile api://xxxxxxx-xxxxxxxxx-xxxxxxxxxxx/access_as_user"),
                            })).ConfigureAwait(false);
...

而且我工作得很好。 我添加了一个 gmail.com 访客帐户,但现在出现错误

{"error":"invalid_grant","error_description":"AADSTS50034: 用户 帐户 Microsoft.AzureAD.Telemetry.Diagnostics.PII 不存在 gmail.com 目录。要登录此应用程序,该帐户 必须添加到目录中。\r\n跟踪 ID: c0a3f945-d446-430c-8e4e-fd77c95a5500\r\n相关 ID: 6cd071f3-b5b0-4ed2-98a2-292f45863e1a\r\n时间戳:2019-04-26 12:31:28Z","error_codes":[50034],"timestamp":"2019-04-26 12:31:28Z","trace_id":"c0a3f945-d446-430c-8e4e-fd77c95a5500","correlation_id":"6cd071f3-b5b0-4ed2-98a2-292f45863e1a"}

我该如何解决这个问题?如果我使用 azure authentiacation 创建基本的 ASP.NET MVC Core 应用程序,该应用程序重定向到 microsoft 页面,则基本应用程序可以与来宾一起使用。

但在我的“静默身份验证”情况下,访客用户不起作用

【问题讨论】:

    标签: c# asp.net-mvc azure azure-active-directory


    【解决方案1】:

    您不能将 ROPC 流程(您在此处使用的)与来宾一起使用。 它不适用于联合帐户。 它也不适用于具有 MFA 或密码过期的用户。 我通常建议人们远离这种流动。

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-05-15
    • 1970-01-01
    • 2019-06-14
    • 2019-04-07
    • 2020-10-16
    • 2020-01-14
    • 1970-01-01
    • 2018-06-27
    相关资源
    最近更新 更多