Magento has restricted API access if two-factor authentication (2FA) is enabled in your Magento 2 account. That becomes a problem if you have already configured your Magento 2 connection using 2FA to access the Magento Admin from additional devices. Then, if you try to authorize a Magento 2 connection in the Integration App, you will get the error “Please use the 2Fa provider-specific endpoints to obtain a token.” To avoid this error, you must re-authorize your connection with a manually generated token.
Note: Only an admin can authenticate a 2FA Magento 2 connection.
Create integration in Magento 2 account to generate an access token
IMPORTANT: For Magento accounts updated to 2.4.4 and above versions, the integration tokens can no longer be used for API bearer token authentication. To revert to the previous behavior, you should either disable two-factor authentication or run the bin/magento config:set oauth/consumer/enable_integration_as_bearer 1 command to restrict the new behavior. For more information, see Token-based authentication.
If 2FA is enabled in your Magento 2 account, you can configure your Integration App connection, as follows:
- Sign in to your Magento 2 account as an administrator.
- Enter the password for the correct authentication app.
- From the left menu, click System > Extensions > Integrations.
- Click Add new integration.
- Below the General section enter Name, Email (optional), and Password.
- In the left menu, click API.
- From the Resource Access drop-down menu, select All.
Note: If you chose Custom, you can’t change the resources once the integration is created.
- Click Save.
- On the Integrations page, next to the newly created integration, click Activate.
- On the Integration page, you can find the list of the resources, click Allow.
- The Integration Token Details are generated.
- Click Done.
Important: The token expires only if you click Reauthorize on the Integration page, next to your integration in your M2 account, or delete the integration.
Configure your Magento 2 connection in Integration App
- Sign in to your integrator.io account.
- Click to open the Magento 2 - NetSuite Integration App.
- Go to Connections.
- Next to the Magento 2 connection, from the Actions menu, select Edit connection.
- In the Token field, enter the Access Token field value generated in the Magento account.
Note: When you enter the value in the Token field, the username and password fields become optional.
- Click Save & close.
For more information, see Install the Magento 2 - NetSuite Integration App.