0

We have an issue with a new Magento 2.4.2 site after migrating from M1 and activating 2 Factor Authentication. The QR code will not load and just displays as a broken image.

Magento 2 Factor Authenticaion Image

2
  • 1
    Any One found the solution ? Commented Nov 9, 2021 at 10:30
  • Anyone have a legit. answer for this? Commented Dec 14, 2021 at 11:25

1 Answer 1

0

This turned out to be caused by an erroneous newline being added to all output. If you inspect the page source (right click => view source) on any page and you see this, then you have the same issue.

view source example

To find the offending file we used Magento's coding standards with PHP_CoderSniffer

magento@12389-php-fpm:~/htdocs$ ./vendor/bin/phpcs --standard=Magento2 app FILE: /app/path/to/file.php ------------------------------------------------------------------------------------ FOUND 1 ERROR AND 2 WARNINGS AFFECTING 3 LINES ------------------------------------------------------------------------------------ 2 | ERROR | [ ] The opening PHP tag must be the first content in the file ------------------------------------------------------------------------------------ PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY ------------------------------------------------------------------------------------ 

Unfortunately CodeSniifer was unable to fix the file automatically, but it was a case of changing

 <?php 

to

<?php 

Then flushing cache.

N.B if the above doesn't find an error for you, you may need to also check vendor, though fixing an issue with a module in vendor would require assistance from the vendor or a patch.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.