creode/business-central-oauth2

A PHP package for seamless OAuth2 authentication with Microsoft Dynamics 365 Business Central, offering a streamlined integration and secure access to Business Central APIs.

1.1.0 2023-12-13 17:00 UTC

This package is auto-updated.

Last update: 2024-04-13 17:46:46 UTC


README

This package provides Microsoft Dynamics 365 Business Central OAuth 2.0 support for the PHP League's OAuth 2.0 Client.

Installation

You can install the package via composer:

composer require creode/business-central-oauth2

Usage

To use this package, you must first configure it by setting the appropriate values in the configuration file. Once configured, you can use the package as follows:

use Creode\BusinessCentralOauth2\Providers\BusinessCentralProvider;

$provider = new BusinessCentralProvider([
    'clientId' => 'your-client-id',
    'clientSecret' => 'your-client-secret',
    'redirectUri' => 'your-redirect-uri',
    'urlAccessToken' => 'your-token-url',
]);

$accessToken = $provider->getAccessToken('client_credentials', [
    'scope' => 'your-scope',
]);

$request = $provider->getAuthenticatedRequest(
    'GET',
    'https://api.businesscentral.dynamics.com/v2.0/{tenantId}/{environmentName}/',
    $accessToken
);

$response = $provider->getParsedResponse($request);

Testing

To run the tests for this package, use the following command:

./vendor/bin/phpunit

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security-related issues, please email security@creode.co.uk instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.