Developer forum

Forum » Integration » BC Connection via Endpoint Management Endpoint and Authentication via OAuth2

BC Connection via Endpoint Management Endpoint and Authentication via OAuth2

Shawn Tehini Dynamicweb Employee
Shawn Tehini
Reply

Hi, 

I am trying to connect via OAuth2 to BC via a DW 9.12.3 site. 

First I noticed that I need to be on a 9.12.0 version to get the option to add an Access Token in the authentication information.  I started with a 9.10.12 site so I am hoping that this is something recently added.  

In Postman I am able to connect with the following:

  Token Name : Whateveryouwant

  Grant Type: Client Credentials

  Access Token URL: https://login.microsoftonline.com/d10e...bfdb7ae/oauth2/v2.0/token

  Client Id: 5a1e.....XXX

  Client Secret: XXX

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

  Client Authentication: Send and Basic Auth Header

 

Using the above I am able to configure a new token and add that to the Bearer Access Token and authenticate.

 

That confirms the AAD Auth in BC and permissions across OAuth2.  Taking the same credientails to the DW authentication endpoint I get the following error:

"AcquireTokenSilent failed. EndpointAuthentication id: 6. Error: No account or login hint was passed to the AcquireTokenSilent call."

Here is the OAuth2 authetication endpoint.  How is the Authorization url being generated?  I initally left the AccessToken blank and the Auth url generated the below:

https://login.microsoftonline.com/d10e1....fdb7ae/oauth2/v2.0/authorize?scope=https%3A%2F%2Fapi.businesscentral.dynamics.com%2F.default+offline_access+openid+profile&response_type=code&client_id=5a1e6....df9fde4e&redirect_uri=https%3A%2F%2Fint-swiftrizzo.mydwsite1.com%3A443%2FAdmin%2FPublic%2FModule%2FEndpointManagement%2FEndpointAuthorization.aspx&client-request-id=9f7d0...f40&x-client-SKU=MSAL.Desktop&x-client-Ver=4.22.0.0&x-client-CPU=x64&x-client-OS=Microsoft+Windows+NT+10.0.14393.0&prompt=select_account&state=https://int-swiftrizzo.mydwsite1.com:443/Admin/Module/IntegrationV2/EndpointManagement/EditEndpointAuthentication.aspx?builderId=d10e1c0c...STau9ncUOZ9iQ

Pasting in the AccessToken generated in Postman did not autheticate either.  Has anyone hit this AquireTokenSiletFail?

 

Thanks, 
Shawn Tehini


Replies

 
Dmitriy Benyuk Dynamicweb Employee
Dmitriy Benyuk
Reply
Hi Shawn, Maybe this can help? https://doc.dynamicweb.com/documentation-9/integration/integration-framework-2/odata/oauth-2-0-business-central Br, Dmitrij
 
Shawn Tehini Dynamicweb Employee
Shawn Tehini
Reply

Hi Dmitriy, 

Looks like there was a fix/upgrade between 9.10.21 and 9.12.  Is there a way that we can deploy that upgrade to a 9.10.21 site?

 

 

Thanks, 

Shawn

 
Dmitriy Benyuk Dynamicweb Employee
Dmitriy Benyuk
Reply

Hi Shawn,
no, it is probably not possible since the changes in the admin UI require the Dynamicweb.Admin dll update.
Also you need to update the Dynamicweb.DataIntegration package to the latest version.
Maybe you can manually merge the changes for this feature into your Dynamicweb 9.10.21.
BR, Dmitrij

 
Shawn Tehini Dynamicweb Employee
Shawn Tehini
Reply

Hi Dmitriy,

Thanks, we tried to manually merge the changes.

We upgraded to Dynamicweb.DataIntegration.dll  3.0.30 (https://www.nuget.org/packages/Dynamicweb.DataIntegration/).  That did not get the required authentication type of "OAuth2 for Business Central Cloud".  

Could the update be in another package?  We did the upgrade on this site for reference: https://int-wolv.mydwsite3.com/Admin/Default

Thanks, 

Shawn

 
Dmitriy Benyuk Dynamicweb Employee
Dmitriy Benyuk
Reply

Hi Shawn,
Updating just DataIntegration package will not solve this, you also need to merge the Admin changes from those commits:
1) Commit 0eb1296c: Add authentication providers to the Endpoint Authentication UI - Repos (azure.com)
2) Commit a514de37: Add Endpoint authentication OAuth2 authorization url copy - Repos (azure.com)
3) Commit 40bbd28f: Add OAuth2 for Crm - Repos (azure.com)
then it should work the same as on 9.12/9.13
BR, Dmitrij

 

You must be logged in to post in the forum