Integration with Business Central

Status
Not open for further replies.

davemtech

Free User
Joined
Nov 12, 2023
Messages
2
Reaction score
1
Hello

Using the 3CX CRM Integration Wizard, we created a template for Business Central (Online).
After adding the template to 3CX and entering our ClientID and ClientSecret, I can click on the Authorize button.
I'm then presented with a login to Microsoft 365. After logging in, I'm returned to https://xxxxx.3cx.ca/api/oauth2crm with an error:

Code:
Error occured while accessing CRM. Please check log provided.
Started OAuthGetRefreshToken
Request text: https://login.microsoftonline.com/xxxxx/oauth2/v2.0/token
Request form value code set to xxxxx
Request form value grant_type set to authorization_code
Request form value client_id set to xxxxx
Request form value client_secret set to xxxxx
Request form value redirect_uri set to https://xxxxx.3cx.ca/api/oauth2crm
Request form value state set to xxxxx
Request form value scope set to https://api.businesscentral.dynamics.com/.default
Response text: {"token_type":"Bearer","scope":"https://api.businesscentral.dynamics.com/Financials.ReadWrite.All https://api.businesscentral.dynamics.com/user_impersonation https://api.businesscentral.dynamics.com/.default","expires_in":4904,"ext_expires_in":4904,"access_token":"xxxxx"}
Response finished
Finished OAuthGetRefreshToken
System.Exception: CRM call result is empty or null
   at ManagementConsoleJS.Controllers.OAuth2CrmController.OAuth(String state, CrmProcessorFactoryDelegate crmProcessorFactory, IMemoryCache cache)

I'm able to authorize and access the Business Central API's in Postman without issue.

Is there a template available for Business Central?

Thanks in advance.
 
Is there a template available for Business Central?
No, we don't support this out of the box, but you should be able to create the template as you're doing.

From the error your get:
System.Exception: CRM call result is empty or null

That means that Business Central is not returning a refresh token in this case. Can you confirm what's the JSON response returned, and if it has the refresh_token value? If this is being returned with a different key, then you will need to adjust the template.
 
You were correct, the refresh_token was not being returned. I switched to a different token URL and now it's working.
Thanks for your assistance.
 
  • Like
Reactions: edossantos
Status
Not open for further replies.

Forum statistics

Threads
112,320
Messages
591,878
Members
165,466
Latest member
EMMEPICASA