Skip to content

QR Code unable to be scanned properly on iOS #375

Closed
@hmireault-devo

Description

@hmireault-devo

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions