web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Suggested Answer

Getting companies doesn't work, show error "Authentication_InvalidCredentials"

(1) ShareShare
ReportReport
Posted on by 4
 
 
In application add this permissions.
 
 
Dynamics 365 Business Central (2)
 
 
 
 
 
 
Financials.ReadWrite.All
Delegated
Access Dynamics 365 Business Central as the signed-in user
No
 
 
 
user_impersonation
Delegated
Access as the signed-in user
No
 
 
In Microsoft Entra Application Card create new entry with client_id. Set "Enabled" and set permission "D365 FULL ACCESS".
 
 
Correctly get access token:
GET https://login.microsoftonline.com/{tenant_id}/oauth2/v2.0/token
body = {
    'grant_type': 'client_credentials',
    'client_id': client_id,
    'client_secret': client_secret,
    'scope': 'https://api.businesscentral.dynamics.com/.default'
}
 
 
From this reference formed URL to getting companies.
 
 
 
 
GET https://api.businesscentral.dynamics.com/v2.0/sandbox/api/v2.0/companies
headers = {
    'Authorization': f'Bearer {access_token}',
    'Accept': 'application/json'
}
 
Why I am getting this error.
{
    "error": {
        "code": "Authentication_InvalidCredentials",
        "message": "Web service call failed because user could not be authenticated or authorized.  CorrelationId:  c5638e54-3987-4a5a-93bc-6e755f11d011."
    }
}
 
 
In addition, I will say that I have experience using Microsoft Graph.
Then try use this tutorial: https://yzhums.com/20690/
 

Thank you in advance. 
Regards
Vitalik

 

 
 
 
I have the same question (0)
  • Suggested answer
    Khushbu Rajvi. Profile Picture
    20,947 Super User 2025 Season 2 on at
    Hi, Please confirm if you have added custom extension in User Permission Sets on MEA.
  • Suggested answer
    YUN ZHU Profile Picture
    95,761 Super User 2025 Season 2 on at
    Hi, It seems to be an authentication issue. A simple test:
    https://api.businesscentral.dynamics.com/v2.0/7e47da45-7f7d-448a-bd3d-1f4aa2ec8f62/Sandbox/api/v2.0/companies
     
    Hope the following helps.
    Using OAuth to connect Business Central APIs and Web Service in Postman
     
    Thanks.
    ZHU
  • VS-29080835-0 Profile Picture
    4 on at
    My extension are not in list "User Permission Sets" on MEA. It seems that this is not required for the Postman request.
    But I am add information to this post and list all permissions which add to Microsoft Entra Application Card in Sandbox.
     
     
    May be need only "D365 FULL ACCESS" but also added another permissions.
     
    ClientID from App also verified if it correct.
     
     
    Microsoft Azure application permissions for Dynamics 365 Business Central is: "Financials.ReadWrite.All", "user_impersonation".
     
     
    Postman also tried to use and still get the same result.
    Screen for check may be I did mistake in data.
    Access Token URL: https://login.microsoftonline.com/c7......................./oauth2/v2.0/token
    Scope: https://api.businesscentral.dynamics.com/.default
    "Advanced" part in Authorization leaved clear.
    TenantID and Client Secret also checked if it correct and Expires date.
     
    "Get New Access Token" successfully execute. Pushed button "Use Token".
    Then send request and get same error "Authentication_InvalidCredentials". CorrelationId:  44d007ea-b579-4243-9c1d-f8e87ab40470.
    If in respond from request was more precisely data in error message about mistake in request data then it easier was to solve.
    All data I check many times.
     
     
     
    Thank you in advance.
    Regards
    Vitalik
     
  • Suggested answer
    Khushbu Rajvi. Profile Picture
    20,947 Super User 2025 Season 2 on at

    Hi Vitalik, I suggest that you add a custom extension to the User Permission Sets in MEA. I strongly believe this is the main issue. Please make this change and test it again.

    If your extension is not in the list, you can create a permission set for it in VSC and publish it. Once you do this, your extension should appear in the permission sets, and you will be able to assign the appropriate permission set to the specific extension.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 2,126

#2
Khushbu Rajvi. Profile Picture

Khushbu Rajvi. 744 Super User 2025 Season 2

#3
YUN ZHU Profile Picture

YUN ZHU 674 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans