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

Basic Authentication failing

(0) ShareShare
ReportReport
Posted on by 42

I am trying to call sandboxed BC cloud API using basic authentication and am getting the following error:

<error xmlns="">docs.oasis-open.org/.../metadata">
<code>Unauthorized</code>
<message>The credentials provided are incorrect</message>
</error>

Get the error when using Postman and code solution.

The basic URL is following:

https://api.businesscentral.dynamics.com/v2.0/sandbox/api/v1.0/companies(sdfsdfsdff0-cwerwerwer4ewerwer-werwe)/accounts

Now this works with OAuth2 bearer token using Postman and code.  

I have copied the key from my user name and I have copied the complete key. 

Basic auth calls are working fine in Docker sandboxed enviroment with Postman and code.  The interesting thing is at first glance the above error would point to credentials issue (id or password) however if I set the wrong password with basic auth in Sandbox I get the following error:

{
"error": {
"code": "Authentication_InvalidCredentials",
"message": "The server has rejected the client credentials. CorrelationId: xxxxxxxxxxxxxxxxxxxxxxxxxxxxx."
}
}

Searches against the first error message appear to relate more to AD tenant authentication.

TIA for any help.

I have the same question (0)
  • Suggested answer
    Stefano Demiliani Profile Picture
    37,166 Most Valuable Professional on at

    Are you passing username (without the domain part) and web service access key? Have you checked the expiration date for the key?

  • Xmeister Profile Picture
    42 on at

    Thanks for reply.

    I am passing without domain name.. so if my login was fred@somewhere.com I'm passing fred. I've tried upper/lower case..

    Expiration date is set to nothing/don't expire.

  • Suggested answer
    Stefano Demiliani Profile Picture
    37,166 Most Valuable Professional on at

    Is your user a Delegated User Account (partner account)? Delegated admins cannot use web service key as we cannot resolve their license without OAuth.

  • Xmeister Profile Picture
    42 on at

    The accounts are linked through AD.. is this equivalent of 'Delegated User' ? Thanks again.

  • Suggested answer
    Stefano Demiliani Profile Picture
    37,166 Most Valuable Professional on at

    What do you mean with "accounts linked"?

    If you're using a regular D365BC user account (your customer's user) you should be able to use Basic Auth without problems.

  • Xmeister Profile Picture
    42 on at

    What I meant was it's set to Office 365 Authentication under the user setting and sign on is through a O365 authentication page linked to organisation.  I assume this implies 'delegated user'?

  • Suggested answer
    Stefano Demiliani Profile Picture
    37,166 Most Valuable Professional on at

    A delegated user is a partner account that your customer has authorized to access his tenant as admin.

    If instead you're using a customer account, this is not the case (and so it should work).

  • Suggested answer
    Rehan Satti Profile Picture
    634 on at

    Hi Xmeister,

    I would suggest to clear the browser cache and try again.

    pastedimage1593676723217v2.png

    and make sure you are picking up the credentials from the right place as shown above.

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 3,229

#2
Jainam M. Kothari Profile Picture

Jainam M. Kothari 1,867 Super User 2025 Season 2

#3
YUN ZHU Profile Picture

YUN ZHU 1,153 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans