phpSPO
phpSPO copied to clipboard
UserFailedLogin error, but login is successful
PHP version: 7.4.13
vgrem/phpSPO version: latest from composer require vgrem/php-spo
I have tested a very minimal setup using the following code snippet
use Office365\SharePoint\ClientContext;
use Office365\Runtime\Utilities\RequestOptions;
use Office365\Runtime\Utilities\UserCredentials;
$username = '[email protected]';
$password = 'userpassword';
$endpoint = "https://tenant.sharepoint.com";
$queryUrl = $endpoint . "/sites/SITE/_api/web/lists/GetByTitle('ListName')/Items";
$request = new RequestOptions($queryUrl);
$authCtx = new AuthenticationContext($endpoint);
$authCtx->acquireTokenForUser($username, $password);
$ctx = new ClientContext($queryUrl, $authCtx);
$resp = $ctx->executeQueryDirect($request);
Data is retrieved and everything seems fine, but in the Azure Active Directory logs, a UserFailedLogin error occurs, and since I fetch quite often on the production application, the errors logs keep spamming the customer's log system.
Is this a known bug for vgrem/phpSPO, anyone else with the same issue?
This could very well be the fault of some configuration on SharePoint or Azure Active Directory, any help is much appreciated.