I keep getting a 403 Forbidden error when I try to call Business Central's Admin Center API. I don't know what the problem is. It could be that the endpoint is wrong or that there is another way to get the required token.
I'm authorising the same way I would if I were using oauth2 to talk to a BC API.
After successfully getting an access token, I have tried the following endpoints in Postman:
But I get the 403 Forbidden error in both cases.
Calls to regular BC APIs seem to work the way they should.
Does anyone know what I'm doing wrong or what I'm not seeing?
UPDATE 1
Now, I've changed the registered app so that it uses delegated permissions and can access any API within BC.
Just like before, getting a token works fine, but the next call gives the same "Forbidden" error as before.
REQUEST (from Fiddler)
RESPONSE (from Fiddler)
If I examine the token with jwt.io, I can't seem to find the part that describes which API the token gives access to, which could be the or part of the problem?
UPDATE 2
I don't understand why, no matter what I do, the access token I get doesn't tell me what it gives access to.
I create a delegated API permission for Business Central (user impersonation and Financials) and register an app.
ReadWrite.All). Then I make something secret.
To get a token, I use the following C# code:
The value in the "access_token" attribute i get from the response, doesn't describe any of the permissions I created when explored with jwt.io. What am I doing wrong here?
My app permissions look like this:
Refer this link for your reference
https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/administration/administration-center-api