1

I am using Magento 2 Instance and while login in to the admin panel I am facing 2FA - Google Auth Not Looking properly. Please check in below Image.

enter image description here

2
  • I would open Network tab in browser and see error response for this QR code image. Maybe you can provide sample admin credentials to see? Commented Nov 11, 2021 at 8:37
  • did you find out the solution , i am also facing the same issue Commented Nov 25, 2024 at 5:59

2 Answers 2

0

Temporary fix: Disable TwoFactorAuth module using below command:

php bin/magento module:disable Magento_TwoFactorAuth 

Then execute the below commands.

php bin/magento setup:upgrade php bin/magento setup:di:compile php bin/magento setup:static-content:deploy -f php bin/magento cache:flush 

Now you are able to login/use the admin of your Magento 2 store.

1
  • Thats Ok but I want to login with Magento_TwoFactorAuth and QR Code image not showing . Commented Nov 11, 2021 at 4:08
0

i also faced the same issue , i am writing here just so that it could be helpful to others . I faced the same issue on Magento version 2.4.7 .

open path vendor/magento/module-two-factor-auth/Controller/Adminhtml/Google/Qr.php

change the function

public function execute() { $pngData = $this->google->getQrCodeAsPng($this->getUser()); $this->rawResult ->setHttpResponseCode(200) ->setHeader('Content-Type', 'image/png') ->setContents($pngData); return $this->rawResult; } 

to

public function execute() { ob_end_clean(); ob_start(); $pngData = $this->google->getQrCodeAsPng($this->getUser()); $this->rawResult ->setHttpResponseCode(200) ->setHeader('Content-Type', 'image/png') ->setContents($pngData); return $this->rawResult; ob_end_clean(); } 

This solved the issue for me . Please make sure your version have the same code before overwriting , the main thing to note here is , i have ob_end_clean() and ob_start().

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.