gpt4 book ai didi

php - PHP 中的 Azure 身份验证错误

转载 作者:行者123 更新时间:2023-12-03 04:20:26 24 4
gpt4 key购买 nike

我在 Azure 身份验证中收到以下错误。请帮助我理解同样的内容。

Fatal error: Uncaught exception'League\OAuth2\Client\Provider\Exception\IdentityProviderException'with message 'invalid_client' in/var/www/html/active/vendor/league/oauth2-client/src/Provider/GenericProvider.php:216Stack trace: #0/var/www/html/active/vendor/league/oauth2-client/src/Provider/AbstractProvider.php(644):League\OAuth2\Client\Provider\GenericProvider->checkResponse(Object(GuzzleHttp\Psr7\Response),Array) #1/var/www/html/active/vendor/league/oauth2-client/src/Provider/AbstractProvider.php(560):League\OAuth2\Client\Provider\AbstractProvider->getResponse(Object(GuzzleHttp\Psr7\Request))

2 /var/www/html/active/src/Delegates/Receive.php(82): League\OAuth2\Client\Provider\AbstractProvider->getAccessToken('authorization_c...',

Array) #3 /var/www/html/active/src/ActiveDirectory.php(180):Magium\ActiveDirectory\Delegates\Receive->execute() #4/var/www/html/active/index.php(25):Magium\ActiveDirectory\ActiveDirectory->authenticate() #5 {main}thrown in/var/www/html/active/vendor/league/oauth2-client/src/Provider/GenericProvider.phpon line 216

我有以下代码

<?php

ini_set('display_errors', 1);
require_once 'vendor/autoload.php';
session_start();

$config = [
'authentication' => [
'ad' => [
'client_id' => 'xxx',
'client_secret' => 'xxx',
'enabled' => '1',
'directory' => 'common'
]
]
];

$request = new \Zend\Http\PhpEnvironment\Request();

$ad = new \Magium\ActiveDirectory\ActiveDirectory(
new \Magium\Configuration\Config\Repository\ArrayConfigurationRepository($config),
Zend\Psr7Bridge\Psr7ServerRequest::fromZend(new \Zend\Http\PhpEnvironment\Request())
);

$entity = $ad->authenticate();

echo $entity->getName() . '<Br />';
// echo $entity->getOid() . '<Br />';
echo $entity->getPreferredUsername() . '<Br />';

网址:https://github.com/magium/active-directory

请帮忙。

最佳答案

Microsoft 使用首次使用的客户端 ID 自动登录。如果是错误的,即使在 .env 文件中更新,它也总是会抛出此错误。如何克服这个问题?

  1. 转到Apps & Services
  2. 针对您尝试登录的应用点击编辑
  3. 点击删除这些权限按钮
  4. 尝试再次进行身份验证

关于php - PHP 中的 Azure 身份验证错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49690419/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com