mirror of
https://github.com/antonioribeiro/google2fa.git
synced 2026-04-27 00:55:49 +03:00
[GH-ISSUE #171] verifyKey always fail - simple demo #316
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/google2fa#316
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @dayeggpi on GitHub (Jul 24, 2021).
Original GitHub issue: https://github.com/antonioribeiro/google2fa/issues/171
I am trying to implement a simple page to try this out.
I am able to generate a QR code, and I get the secret code.
I add the QR code to an app, and it works fine.
Then when I try to test the OTP code in order to validate it, it always fails.
Below the code I have.
index.php :
I scan the QR code with my app, then I save $secret, keep the page open and open a new tab and go to url verif.php?secret=$secret&code=XXXXXX
with $secret being the $secret from output of index.php and XXXXXX being what the app gives me.
In verif.php I have the following :
As there are no clear full code and always small parts of code, I find it difficult to implement.
I am new to that but I am trying.
Thank for your help.
@dayeggpi commented on GitHub (Jul 24, 2021):
my bad....I generate a second time "$secret = $google2fa->generateSecretKey();" which is therefore not the same secret as the QR code...hence it always fails...
changed index.php to the following and it all works better of course.
index.php