Skip to main content

Notifications

Small and medium business | Business Central, N...
Suggested answer

AADSTS900144 body must contain 'client_id' AcquireTokenByAuthorizationCode

Posted on by 69

Hi,

When using the AcquireTokenByAuthorizationCode in codeunit OAuth2 to call a business central API in OAuth, I consistently get this error message

pastedimage1683128288456v1.png

Which I don't understand since I'm sending a client ID.

Is there a certain way to call this procedure ? 

  • Valentine Motin Profile Picture
    Valentine Motin 69 on at
    RE: AADSTS900144 body must contain 'client_id' AcquireTokenByAuthorizationCode

    Hi Yogender, thanks for your reply.

    Part of the message in the window is in french and only says Sorry we re having troubles to connect you. I will try to detail my process a bit.

    What I want to do is to expose an API in Business central, and to call this same API in business central (so I am auto calling my own API in the same base, I have reasons to set it up that way).

    The setup was working fine using Basic Authentification but I am now trying to make it work using OAuth On Premise.

    I set up the OAuth authentification on my On Premise business central (with a client secret), it works well and I can call my API in postman. The grant type in Postman is setup to Authorization Code.

    What I now need to do is to call this API in AL in business central.

    I have done this before in Basic Auth and in OAuth with another API but the existing procedure in the codeunit OAuth2 "AcquireTokenByAuthorizationCode", that seems to be exactly what I'm looking for, does not work.

    When I try to call this procedure, with the same parameters that i've used in postman, I get the error message linked in my first post that indicates that the body should contain 'client_id', which I don't understand since I don't have control on this procedure appart from the parameters that i send.

    That's why I was wondering is there was any known issue regarding this specific procedure.

    Hope I cleared things out enough.

  • Suggested answer
    Nitin Verma Profile Picture
    Nitin Verma 21,091 Super User 2024 Season 1 on at
    RE: AADSTS900144 body must contain 'client_id' AcquireTokenByAuthorizationCode

    Please use below link to check if you have correctly setups the OAuth2.0 app registration

    www.navwithnav.com/.../

  • Suggested answer
    RE: AADSTS900144 body must contain 'client_id' AcquireTokenByAuthorizationCode

    Hi Valentine Motin,

    I hope you have created a Client ID and Client Secret from the Azure active directory. 

    If not, please create using this link - support.smartbear.com/.../tutorial-azure.html

    Or please explain the issue as the screenshot is having a language that I don't understand.  Share the process from which you are getting error. 

    Regards,

    Yogender Singh Rana

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!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

New! Quick response templatesâš¡

Save time with the new custom templates!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 229,928 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans