QRCoder icon indicating copy to clipboard operation
QRCoder copied to clipboard

QR Code unable to be scanned properly on iOS

Open hmireault-devo opened this issue 4 years ago • 2 comments

Type of issue

[X] Bug

Expected Behavior

QR Codes generated with the same payload on version 1.4.2 and version 1.4.3 should result in the same image, and should be properly readable no matter the platform.

Current Behavior

On QRCoder 1.4.3, codes generated with a certain payload are not able to be read properly on Microsoft Authenticator on iOS. On Android, there are no problems reading the QR code. Codes generated on version 1.4.2 of the library work properly no matter the platform.

Possible Solution

I suspect the space character in the issuer or label is causing the issue, and it may be handled differently in version 1.4.3 compared to the previous version. When trying to reproduce the issue with an issuer and label without spaces, the issue does not occur.

Steps to Reproduce

Sample code to generate the faulty QR code image:

QRCodeGenerator qrcodeGenerator = new QRCodeGenerator();
PayloadGenerator.OneTimePassword generator = new PayloadGenerator.OneTimePassword()
{
    Secret = "M54WC6TFJB2TQSCFGA2WOWLFIJCWOWSV",
    Issuer = "My Test Issuer",
    Label = "My Test Label"
};

QRCodeData qrcodeData = qrcodeGenerator.CreateQrCode(generator);
QRCode qrcode = new QRCode(qrcodeData);
this.pbQR.Image = qrcode.GetGraphic(5);

Generating the QR code image with version 1.4.2 will give the following: QRCoder - Test 1 4 2

Generating the QR code image with version 1.4.3 will give the following: QRCoder - Test 1 4 3

When using the Microsoft Authenticator app on iOS and scanning the first code, everything works. When using the Microsoft Authenticator app on iOS and scanning the second code, the error "Invalid URL or Barcode" is shown.

When using the Microsoft Authenticator app on Android, both codes work.

Your Environment

  • Version used: 1.4.3
  • Compiled from source or NuGet package?: NuGet package
  • Payload/Encoded text: Described above in the code sample
  • Used payload generator: OneTimePassword
  • Environment (.NET 3.5, .NET 4.X, .NETCore, ...): .NET 4.8

hmireault-devo avatar Jan 12 '22 18:01 hmireault-devo

The 1.4.3 example QR code above also generates an error when scanned with LastPass Authenticator.

The error message is: Device Pairing Failed Bad code: bad scheme (com.logmein.lpa.error / -5)

It works with Authy.

craigpeterson-GAS avatar Feb 01 '22 17:02 craigpeterson-GAS

We're experiencing the same problem, with similar code to the OP. All of our test devices worked fine with 1.4.2, but starting with 1.4.3 we're seeing issues with some authenticator apps (Microsoft and LastPass) on iOS devices.

jimivey avatar Feb 01 '22 20:02 jimivey

Should be fixed with: https://github.com/codebude/QRCoder/pull/391 The PR will be part of QRCoder 1.5.0 which will be released within the next couple of days. Please re-open in case 1.5.0 still shows the same problem.

codebude avatar Apr 07 '24 20:04 codebude