Magento integration (enabling REST API)

Created by Tys van den Heuvel, Modified on Thu, 16 Apr at 10:11 AM by Tys van den Heuvel

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.


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.



Magento 2.4.4+

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. 


Reauthorize integration

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.


Enable 

https://devdocs.magento.com/guides/v2.4/get-started/authentication/gs-authentication-token.html


Hosting Platform Specific Notes

There are a few Magento hosting providers who by default restrict the use of the REST API. 

Click here for more details. 


Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article