1

I'm running a Magento 2.3.5-p2 site, but the dynamic images generated in the admin don't appear to load. When I updated to 2.4 the graph problem goes aways as the graphs are drawn with canvases instead, but the 2FA QR code issue remains.

I have tried disabling all 3rd party modules, but this hasn't made any difference Magento 2: Disable all custom and Third Party Module in single Command.

My hosting (Cloudways using AWS) provider doesn't think it is a server problem.

See screenshots below:

Magento 2 admin Graph image not loading Magento 2 admin Graph image not loading canvases

Magento 2 admin 2FA Google Authenticator QR code image not loading Magento 2 admin 2FA Google Authenticator QR code image not loading

enter image description here

problem image urls are typically in this format https://m2.skates.co.uk/sk_admin/tfa/google/qr/key/6d51a9c283d43f0482ee69f53c51cde655eb5b12a51bf431f84752c493e9974e/

All other image types in both the admin and front end work perfectly fine.

Any ideas? Thanks so much for reading.

2
  • 1
    Please refer this link.
    – Pratik Oza
    Commented Aug 18, 2020 at 19:50
  • @PratikOza did u get solution ? Commented Nov 9, 2021 at 10:39

3 Answers 3

0

I guess the issue is related the 2FA module. The 2FA module moved to Magento official repo (Member of MSP Security Suite) and now name is different. So, you need to remove old module.

New one: msp_twofactorauth

Please refer this link: Important notice and the official repo: magespecialist_TwoFactorAuth

Disable module OR remove old directory MSP(do backup before) and run following command:

composer require msp/twofactorauth
1
  • Thanks. The module I have is the newer one that is included with official Magento 2, so I don't think this will help. Commented Aug 20, 2020 at 13:58
0

For anyone interested my issue was the content security policy. I had unblock the following domains for img-src

cm.everesttech.net

a5.behance.net

amcglobal.sc.omtrdc.net

and connect-src

amcglobal.sc.omtrdc.net

0

I solved it by maing following changes:

Firstly, in PATH: vendor/msp/twofactorauth/Model/Provider/Engine/Google.php

in function getQrCodeAsPng(), change return $pngData; to return $qrCode->writeDataUri();


Secondly, in PATH: vendor/msp/twofactorauth/Block/Provider/Google/Configure.php

in function getJsLayout(), change:

From:

$this->jsLayout['components']['msp-twofactorauth-configure']['qrCodeUrl'] = $this->getUrl('*/*/qr');

To:

$this->jsLayout['components']['msp-twofactorauth-configure']['qrCodeUrl'] = $this->google->getQrCodeAsPng($this->session->getUser());

FYI: You can override these files and create a seperate module if you wish not to modify the files directly in the vendor folder

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.