We've looked everywhere for examples of how to get an OAuth token in al code in our codeunit. We can get the token in Postman, so I know that all of our credentials are right. But it has been very hard to find examples of how to do this on the Internet.
I did find this.al page from Microsoft that looks like it has an example of how to use OAuth2.AcquireTokenWithClientCredentials, but we can't get it to work. https://github.com/microsoft/BCTech/blob/master/samples/OAuth2Flows/TestOAuth2Flows.Page.al
Does anyone have an example of how this would work?
This sort of connection can be used to connect to Business Central Admin APIs using the OAuth2 authentication technique; the system that accesses the exposed API services utilises a token issued by the access process, and there are multiple ways to release the token.
For implementation refer the given link..