Developer forum

Forum » Integration » Credentials in Business Central

Credentials in Business Central

Jonas Krarup Dam
Reply

Hi, I have a question from an ERP partner: 
-----------------------------------

Kan vi få dynamic web til at bruge api, i stedet for personalizion.

 

I kaldet for at få en token , skal vi have scope: https://api.businesscentral.dynamics.com/.default, og granttype: ”Client Credintials”

 

Request body to get token:

grant_type: "client_credentials"

scope: https://api.businesscentral.dynamics.com/.default

client_id: "xx"

client_secret: "xx"

 

Som det er i dag, så er det brugeren som har granted credentials, og ikke apikeyen, som registreres på transactioner.

---------------------------------

Thanks, Jonas


Replies

 
Dmitriy Benyuk Dynamicweb Employee
Dmitriy Benyuk
Reply

Hi Jonas,

it is not clear what the problem is.
Our token generation class uses this scopes: "https://api.businesscentral.dynamics.com/.default", "offline_access"
and also Microsoft.Identity.Client library that does all the token obtaining and it also uses the tenant id, client id and client secret.
I am not sure what is the exactly request body for getting the token request since it is all deeply hidden in the MSAL Microsoft.Identity.Client library.
You can read more about this library here. If your partner can find that this library supports any api keys instead in the application registration/bulding
for getting token then I can look on how to get them working in our project.
BR, Dmitrij

 
Jonas Krarup Dam
Reply

Hi Dmitriy,

Clarification from our EPR partner:
-----------------------------------------------------------------------

When we define the api in Azure, we have two options, and you are using the first one

If you look at the msal documentation  it states that

 

 

 

I hope that this make it easier to understand what we want to achieve


----------------------------------
Thanks, Jonas

 
Jonas Krarup Dam
Reply

Bump - have you had a chance to look at this?

 

 
Dmitriy Benyuk Dynamicweb Employee
Dmitriy Benyuk
Reply

Hi Jonas,
I am currently investigating this and will get back with the results
BR, Dmitrij

 
Dmitriy Benyuk Dynamicweb Employee
Dmitriy Benyuk
Reply

Hi Jonas,
I currently have one "local" version for the DataIntegration package that can support this ClientCredentials flow.
Can you download this package from here and try to setup the AD app and BC app as described here:
https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/administration/automation-apis-using-s2s-authentication
and then create a new Endpoint Authenticaion in DW without filling/going to BC login page outside Dynamicweb (simply do not login or close the 
opened new window with BC authenticaion dialog) and then check your endpoint works as needed in Dynamicweb?

BR, Dmitrij

 

You must be logged in to post in the forum