Skip to content

[5.x]: Google Authenticator app shows dashes for 2FA (Two-Factor auth issue) #16552

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Romanavr opened this issue Jan 28, 2025 · 4 comments
Closed
Assignees
Labels

Comments

@Romanavr
Copy link

What happened?

Description

Our users are experiencing issues when using 2FA for Android “Google Authenticator app”.
After scanning a QR code when setting up 2FA for any account, the Google app shows underscores instead of the real code.
However, if you enter the secret code manually, it works fine.

I did some testing and found out that it might be has something to do with the #16466.
When I convert the QR code to a URL (text), it displays something like this:
otpauth://totp/Site%20English:roman%site.com?secret=*normal secret values goes here*&issuer=Site%20English&algorithm=SHA1&digits=6&period=30

So, as you can see HTML encoded characters present in the URL
I checked it on two sites, both of them have "-" in the site name. And in both cases issue is reproduced.

Steps to reproduce

  1. Create site with the dash in the name.
  2. Try to scan the QR code through "Google Authenticator" app on the android.

Expected behavior

It should show you a generated code

Actual behavior

It shows dashes.

Craft CMS version

5.6.1 Pro

PHP version

8.3

Operating system and version

Ubuntu 20.x

Database type and version

MySQL

Image driver and version

Installed plugins and versions

@Romanavr Romanavr added the bug label Jan 28, 2025
@Romanavr
Copy link
Author

I found out that the problem with the secretValue.
I generated a QR code without spaces within the secret value and it worked.
With spaces it is displayed dashes.

@i-just i-just self-assigned this Jan 28, 2025
@smnedelko
Copy link

The problem exists on Android smartphones, on iPhones everything is fine.

@i-just
Copy link
Contributor

i-just commented Jan 28, 2025

Hi, thanks for reporting and providing a solution 🙂 I raised a PR for this.

@brandonkelly
Copy link
Member

Craft 5.6.2 is out with that fix. Thanks all!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants