Magento integration (enabling REST API)
Until Magento 2.4.3 the only way to connect with other systems was to create a so-called integration. As of 2.4.4 Magento has introduced the use of oAuth2 for authentication. Right now Commerce 365 still makes use of integrations. oAuth2 support will be added soon.
Magento 2.4.4 - Allow OAuth Access Tokens to be used
When running Magento 2.4.4, please follow the instructions found after clicking this link.
Otherwise you can just proceed with the instructions below.
Add New Integration
In the Magento backend, go to System > Integrations, and click on Add New Integration. On the next page you only have to provide a name, preferably ‘Commerce 365’, and on the second tab (API) just select Resource Access: All. Then click Save & Active. The system will show you a confirmation on all the resources this integration can access. Click Allow, and you will find the final screen which shows you 4 integration tokens.
Next, you have to copy the Access Token, because that is the one we need in Business Central.
As of Magento 2.4.4 the use of these Bearer Tokens / Access Tokens has been disabled by default. To enable this, go to Stores > Configuration > Services > OAuth > Consumer Settings. Here you can set Allow OAuth Access Tokens to be used as standalone Bearer tokens to YES.
If for some reason the Magento API is throwing errors that look like ‘Consumer is not authorized to access %resources’ it might be that the Access Token you are using is invalid. You can reauthorize the token by going to System > Integrations, and click on the ‘Reauthorized’ link for your integration. On the next page click on the Reauthorize button, and then copy the Access Token, and then click Done. Now paste the token in Business Central (Administration Setup Magento Magento REST API Access Token), and then check your connection status.
Hosting Platform Specific Notes
There are a few Magento hosting providers who by default restrict the use of the REST API.
Fully automated installation and onboarding
Install via AppSource
Click on the AppSource button, install the free trail, and just follow the instructions