Skip to main content

Notifications

Community site session details

Community site session details

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

Web service call failed because user could not be authenticated or authorized

(0) ShareShare
ReportReport
Posted on by

I would like to share this information with all of you

Issue Summary:

if you are calling the Business Central REST API via OAuth2 authentication fails with the error message "Web service call failed because user could not be authenticated or authorized."

and in the event viewer, you got this warning 

pastedimage1673250084984v1.png

RCA:

When you create the APP reg in the Azure portal and add the needed params to your postman or any tool that you used to generate the token, the token is generated correctly

If you take this token and use this link: JSON Web Tokens - jwt.io 

This link is very helpful to show you the token data added so you will find it missing an important part which is ( Roles )

pastedimage1673250270542v2.png

This issue related to the wrong scope added to the request being wrong

pastedimage1673250386816v4.png

It should be https://api.businesscentral.dynamics.com/.default

  • Verified answer
    Microsoft Dynamics 365 Business Central Profile Picture
    on at
    RE: Web service call failed because user could not be authenticated or authorized

    not a question

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Jonas ”Jones” Melgaard – Community Spotlight

We are honored to recognize Jonas "Jones" Melgaard as our April 2025…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 294,095 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 232,866 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,158 Moderator

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans