Magento Please use the 2fa provider-specific endpoints to obtain a token error REST API on Admin token.

Magento Rest API to fetch admin token credentials to use tokens for other REST APIs as Authorization Bearer.

From Magento 2.4+, the Two Factor Authentication Module is available for security reasons.

If you try for the first time to generate Admin Token by REST API and you will face an error in a response like below, You have authenticated Google 2FA for security reasons. Continue reading “Magento Please use the 2fa provider-specific endpoints to obtain a token error REST API on Admin token.”

Url Encode and Decode using Magento 2.

You can encode and decode the URL using Magento 2 with native functionality.

Using Url Encode, they encode the base64_encode() for URLs encoding using encode() function.

Using Url Decode, they decode the base64_decode() for URLs decoding. Continue reading “Url Encode and Decode using Magento 2.”

How to prevent error: Use of $_FILES is discouraged in Magento 2?

How to prevent the use of global variable $_FILES in code?

Magento application does not directly use any PHP superglobals variable like $GLOBALS, $_SERVER, $_GET, $_POST, $_FILES, $_COOKIE, $_SESSION, $_REQUEST.

You don’t need to directly use $_FILES in your code for file/images save. This may be lead to security vulnerabilities. Continue reading “How to prevent error: Use of $_FILES is discouraged in Magento 2?”