Download the PHP package rebelpl/oauth2-businesscentral without Composer
On this page you can find all versions of the php package rebelpl/oauth2-businesscentral. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download rebelpl/oauth2-businesscentral
More information about rebelpl/oauth2-businesscentral
Files in rebelpl/oauth2-businesscentral
Package oauth2-businesscentral
Short Description Business Central OAuth 2.0 Client Provider for The PHP League OAuth2-Client
License MIT
Informations about the package oauth2-businesscentral
Business Central OAuth2 Client
This package provides # Business Central OAuth 2.0 support for the PHP League's OAuth 2.0 Client.
Pre-requisites
The app you want to connect to BC must be setup in Entra admin center > Identity > Applications > App registrations
There are two main authorization flow options, you need to set up your app accordingly:
Option 1: Client credentials (service-to-service)
With this option the app will always work with the same set of permissions - defined in Business Central.
- Authentication: Web + Redirect URI = https://businesscentral.dynamics.com/OAuthLanding.htm
- Certificates & secrets: New client secret
- API permissions: Add permission > Dynamics 365 Business Central > Application permissions > API.ReadWrite.All
In Business Central go to Microsoft Entra Applications, add the New app using Application (client) ID. Set up permissions required for the app (for example D365 BUS FULL ACCESS). Depending on the tenant's settings, administrator might need to "Grant Consent" for the app.
Option 2: Authorization code (login-as)
With this option the app will work with the permissions of the user who uses it (and needs to log in).
- Authentication: Web + Redirect URI = https://your-app-url/callback-url
- Certificates & secrets: New client secret
- API permissions: Add permission > Dynamics 365 Business Central > Delegated permissions: Financials.ReadWrite.All, user_impersonation
Depending on the tenant's settings, administrator might need to grant consent for the app. You can use $provider->getAdminConsentUrl() for that purpose.
Installation
To install, use composer:
Usage
Usage is the same as The League's OAuth client, using \Rebel\OAuth2\Client\Provider\BusinessCentral as the provider.
Client Credentials Grant
Authorization Code Grant
Refreshing a Token
Use access token - API v2
Use access token - OData v4
Testing
`