MADHDA Business Solutions
  • Home
  • About Us
    • Privacy Policy
  • Services
    • Implementations
    • Support
    • Training
    • Upgrade
    • Business Analysis
  • Solutions
    • MS Dynamics 365 Business Central
    • MS Dynamics Nav
    • MS Dynamics 365 Sales/CRM
    • Power BI
    • Power Automation
  • Resources
    • Blog
  • Contact Us
  • Change Authentication method from Basic Auth to OAuth2 while accessing Business Central Webservice / APIs.

Change Authentication method from Basic Auth to OAuth2 while accessing Business Central Webservice / APIs.

27 February 2023

Change Authentication method from Basic Auth to OAuth2 while accessing Business Central Webservice / APIs.

Hello Reader,

 

Why we need OAuth option?

  • Microsoft has stated a long time ago that Web Service Access Key (Basic Authentication) will not be supported. They have deprecated capability to access web services using Basic Auth for SaaS. So, now OAuth2 will be the only Authentication option available. This change will not affect on how Business Central connects to external applications.
  • For on-premises, web service key will work for the time being.

 

How to Configure/Use OAuth?

Step 1: Login into the Microsoft Azure Portal. [https://portal.azure.com/#home]

 

Step 2: Search/Navigate to App Registrations.

 

  • Click on New Registration to create new app registration.

 

  • Fill the mandatory information, Name, Account Type and click on Register.

 

  • User will be able to see the important information after the application is successfully created.

 

Step 3: Choose API Permission and click on the add a permission button after that we need to select Business Central Application because we’re requesting Authorization for BC API permission.

 

  • You can choose what permissions are required depending on your situation. In this case, we chose Application Permission.

 

  • Now, Admin user will grant the permission by clicking Grant admin consent

 

Step 4: Navigate to the Certificates & Secrets to generate token, click on the New Client Secret. Add description and select expires and then click on Add.

 

  • As you can see now, we have Token value. Configuration in azure portal is completed.

 

  • The following detail you can get.
  • Application Client ID
  • Certificates & Secrets Value
  • Directory Tenant ID

 

Step 5: Now, we need to configure the Azure active directory Applications in Business Central environment.

 

  • Create a new record and enter the Client ID, Description, and then assign permissions. Once you fill in all the information, then change the state to enabled.

 

  • Note:

 

Step 6: Testing

  • In our case we have used postman application to call web service using OAuth Token. Choose Authorization Type as OAuth 2.0 and select Request Headers in Add Authorization data to.
  • Add Token Name and select Client Credentials in Grant Type.
  • Access Token URL: https://login.microsoftonline.com/User Your Token/oauth2/v2.0/token
  • Scope: https://api.businesscentral.dynamics.com/.default
  • Client Authentication: Send client credentials in body.
  • Now, Choose Get New Access Token.

 

  • Now, click on User Token.

 

 

  • As you can see in below image, we are able to connect with Business Central using OAuth Authentication

 

For more detailed Information:

  • Overview of permissions and consent in the Microsoft identity platform – Microsoft Entra | Microsoft Learn

 

 

Stay connected with Madhda to learn More!

For more details, pls visit our website www.madhda.com or contact us on Contact@madhda.com

 

Thanks to all.

Madhda

Previous post: How to use “Dictionary” Object type into Business Central.
Next post: Business Central : Retrieving Azure AD User information via AL.

Categories

  • Microsoft Dynamics 365
  • Microsoft Dynamics Business central
  • Microsoft Dynamics NAV
  • Uncategorized

Recent Post

  • Business Central : Retrieving Azure AD User information via AL.
    March 20, 2023
  • Change Authentication method from Basic Auth to OAuth2 while accessing Business Central Webservice / APIs.
    February 27, 2023
  • How to use "Dictionary" Object type into Business Central.
    February 17, 2023
  • Post Transaction Using Configuration Package in Business Central.
    February 13, 2023
  • How to Import Image from Excel to BC using Azure function.
    February 6, 2023
 


    © Copyright 2020 | All Rights Reserved By MADHDA