如何通过PHP上的多因素身份验证使OAuth2在Azure Active Directory中工作

问题描述 投票:0回答:1

我们正在Azure Active Directory上使用OAuth 2.0身份验证代码授予,使用http://guzzlephp.org/对Web应用程序中的用户进行身份验证>

这一直没有问题,但是现在AD维护人员希望部署多因素身份验证。我们当前的OAuth实现与此不一致。

这是我们的代码:

        $url = 'https://login.windows.net/' . $directoryIdAzure . '/oauth2/token'
            /** @var GuzzleHttp\Client $client **/
            $response = $client->post(
                $url,
                [
                    "headers" => [
                        "Accept" => "application/json"
                    ],
                    'form_params' => [
                        'resource'      => 'https://analysis.windows.net/powerbi/api',
                        'client_id'     => $clientIdAzure,
                        'client_secret' => $clientSecretAzure,
                        'grant_type'    => 'password',
                        'username'      => $user,
                        'password'      => $pass,
                        'scope'         => 'openid',
                    ]
                ]
            );``` 

Return this error:



error: 
 "error": "interaction_required",
    "error_description": "AADSTS50076: Due to a configuration change made by your administrator, or because you moved to a new location, you must use multi-factor authentication to access

我们正在使用Azure Active Directory上的OAuth 2.0身份验证代码授权,以通过http://guzzlephp.org/在我们的Web应用程序中对用户进行身份验证,这没有问题,但是现在是AD ...

php oauth microsoft-graph
1个回答
0
投票

Microsoft建议您不要使用ROPC flow。在大多数情况下,都可以使用并推荐更安全的替代方法。此流程需要对应用程序非常高度的信任,并承担其他流程中不存在的风险。仅当无法使用其他更安全的流时,才应使用此流。

© www.soinside.com 2019 - 2024. All rights reserved.