Skip to content
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

Not Working in Microsoft Authenticator App but in Google Authenticator #18

Open
KBITSERVICES opened this issue Feb 16, 2021 · 2 comments
Assignees
Labels

Comments

@KBITSERVICES
Copy link

KBITSERVICES commented Feb 16, 2021

Hi,

i'm using the following code to generate QRCode for TOTP:

tfa = new TwoFactorAuth("ADRM", 6, 60);

secret = tfa.CreateSecret(80, CryptoSecureRequirement.RequireSecure);

secretlabel.Text = secret;


AppSettingsHandler.Handler.AddOrUpdateSetting("secret", secret);


              

String uri = tfa.GetQrText("ADRM", secret);


QRCodeGenerator qrGenerator = new QRCodeGenerator();
QRCodeData qrCodeData = qrGenerator.CreateQrCode(uri, QRCodeGenerator.ECCLevel.Q);
QRCode qrCode = new QRCode(qrCodeData);
Bitmap qrCodeImage = qrCode.GetGraphic(20);

                


pictureBox1.Image = qrCodeImage;

My Problem is that if i scan the Code with Microsoft Authenticator i get an other code as Google Authenticator.

Googles Code is correct, microsoft's isnt.

Can you help please?

@RobThree
Copy link
Owner

RobThree commented Feb 16, 2021

Not all authenticators support all variations of periods, digits, algorithms and number of secret bits. So I'd start with testing the most common combination: 30 second periods, 6 digits, sha1, 80 bits. I see you're using 60 second periods so I bet that's the problem.

Repository owner deleted a comment from KBITSERVICES Feb 16, 2021
@RobThree RobThree self-assigned this Feb 16, 2021
@StuFrankish
Copy link

Just to add to this as I've come across a similar issue.
I've had to push the algorithm being used down to SHA1 for the most broad compatibility, as to date, the Microsoft authenticator app still won't work with SHA256 or SHA512.

Using a 6 digit code and 30s period.

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

3 participants