How to Integrate farmerswife with Microsoft Dynamics 365 Business Central Using OAuth 2.0


Overview

As Microsoft has deprecated Web Service Access Keys (Basic Auth) for Business Central Online, all integrations must now transition to OAuth 2.0 for authentication. This guide outlines how to configure OAuth-based access between farmerswife and Business Central 365 (BC365) and ensure compatibility with modern payroll systems such as 365 Payroll.


This setup enables secure, token-based data exchange between the two platforms — ideal for syncing scheduling, personnel, or financial data with ERP workflows.


Prerequisites

  • Access to Microsoft Azure portal with permissions to register applications.

  • Administrative access to Business Central 365.

  • farmerswife server version 7.1  or later.

  • A developer or IT contact who can run test calls using Postman or similar.


Step-by-Step Setup

1. Register an App in Azure Active Directory

To enable OAuth, start by creating or expanding an Azure App Registration:

  • Go to Azure Portal

  • Navigate to Azure Active Directory > App registrations

  • Click "New registration"

    • Name: farmerswifeAzureSync (or similar)

    • Supported account types: "Accounts in this organizational directory only"

    • Redirect URI: Not required for service-to-service calls

Once created:

  • Note down the Application (client) ID

  • Generate a Client Secret under Certificates & secrets

Ensure this app has the following API permissions:

  • Dynamics 365 Business Central → Delegated or Application permissions:

    • Financials.ReadWrite.All

  • Microsoft Graph → As required (e.g., for Exchange integration)

2. Grant Admin Consent

Still in Azure:

  • Under API permissions, click Grant admin consent.

3. Enable Business Central Web Services

In Business Central 365:

  • Ensure the necessary web services are published.

    • Go to Web Services in BC365

    • Publish the required pages/codeunits (e.g., employee exports, project updates)

  • Confirm the URL structure, which typically follows:

    https://api.businesscentral.dynamics.com/v2.0/{tenant-id}/{environment}/WS/{company}/
    

4. farmerswife Configuration

On the farmerswife side:

  • Ensure you're running a version that supports OAuth (v7.1+).

  • Use the gathered Azure credentials (Client ID, Secret, Tenant ID) to configure the REST API authentication settings.

  • Setup the integration endpoint using:

    • OAuth grant type: Client Credentials

    • Token endpoint:

      https://login.microsoftonline.com/{tenant-id}/oauth2/v2.0/token
      

5. Test the Integration

Use Postman or equivalent to simulate API calls:

  • Generate an OAuth 2.0 token using the Azure client ID and secret

  • Make authenticated GET/POST requests to BC365 Web Services endpoint

  • Verify successful 200 OK responses and data payloads

farmerswife also uses Postman internally to validate these credentials during development, so mirroring this process can help in troubleshooting.


Optional: Handling Field Mapping for 365 Payroll

If you're integrating with a new Payroll system (e.g., 365 Payroll) that has different field names:

  • Export a list of expected field names from farmerswife

  • Compare with the new system's schema

  • Update the mapping configuration inside farmerswife (via the Navision Settings or equivalent export module)

  • Field mapping changes may require development work if they exceed existing configuration limits


Testing & Deployment

Once the configuration is complete:

  • Set up a test database/environment for end-to-end verification

  • Perform real-life workflows (e.g., creating vacation requests, syncing personnel data)

  • Validate correct data flow into BC365

After successful tests:

  • Schedule the production upgrade

  • Make sure all endpoints and authentication settings are updated in production

  • Inform users about any required local updates (e.g., desktop app reinstall, URL change)


Summary

Integrating Farmerswife with Business Central 365 via OAuth enhances both security and compliance. With proper Azure configuration, published web services, and validation routines, customers can benefit from a robust, modern ERP integration workflow that supports evolving payroll systems and cloud standards.


Did you find it helpful? Yes No

Send feedback
Sorry we couldn't be helpful. Help us improve this article with your feedback.