Skip to main content

Notifications

Announcements

No record found.

Small and medium business | Business Central, N...
Answered

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

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
    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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans