scheb / 2fa

Two-factor authentication for Symfony applications 🔐
MIT License
505 stars 75 forks source link

The window option for google configuration does not seem to work as described #167

Closed O-Yilmazer closed 1 year ago

O-Yilmazer commented 1 year ago

In the documentation reference, it mentions that the window option defines how many codes should be accepted around the current code.

# config/packages/scheb_2fa.yaml
scheb_two_factor:
    google:
        enabled: true                  # If Google Authenticator should be enabled, default false
        server_name: Server Name       # Server name used in QR code
        issuer: Issuer Name            # Issuer name used in QR code
        digits: 6                      # Number of digits in authentication code
        window: 1                      # How many codes before/after the current one would be accepted as valid
        template: security/2fa_form.html.twig   # Template used to render the authentication form

So I would think if you had window: 2 it would accept 2 codes before the current code and 2 codes after the current code. However, it doesn't seem to work like that.

Could it be that the behavior of the window option has changed but the documentation was not updated? And if so could we bring back the old behavior?

P.S. I did some digging and it seems like there has been a change in that part of the code. https://github.com/Spomky-Labs/otphp/pull/152/

scheb commented 1 year ago

Looks like you're right. The meaning of that parameter changed in v11 of the Spomky-Labs/otphp dependencies. Either downgrade to v10, or accept the fact that with v11 you can no longer have a larger window than 1 period :/

I'm adding comments to the docs as a warning.