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

generateURI doesn't work with Google authenticator #20

Closed
ckr opened this issue Mar 16, 2015 · 9 comments
Closed

generateURI doesn't work with Google authenticator #20

ckr opened this issue Mar 16, 2015 · 9 comments
Assignees
Labels

Comments

@ckr
Copy link

ckr commented Mar 16, 2015

It looks like google doesn't like digits, digest and interval in the provisioning url.

@Spomky Spomky self-assigned this Mar 16, 2015
@Spomky
Copy link
Member

Spomky commented Mar 16, 2015

I just tried to generate a TOTP including digits, digest and interval parameters and it works fine for me.

Please, could you try this one, it is correctly loaded on Google Authenticator (v2.49) and codes generated are correct:
otpauth://totp/Bar%3AFoo?algorithm=sha1&digits=6&issuer=Bar&period=30&secret=KRUGS4ZANFZSA3LZEBZWKY3SMV2A
Code

@Spomky Spomky added the bug label Mar 16, 2015
@ckr
Copy link
Author

ckr commented Mar 16, 2015

Still doesn't scan on google authenticator for ios

@Spomky
Copy link
Member

Spomky commented Mar 16, 2015

OK my tests are based on Google Authenticator for Android.

If the following code is correctly loaded on your app, I will update my library.
I think I will remove parameters if algorithm=sha1, period=30 and digits=6.
otpauth://totp/Bar%3AFoo?issuer=Bar&secret=KRUGS4ZANFZSA3LZEBZWKY3SMV2A
Code

@ckr
Copy link
Author

ckr commented Mar 16, 2015

@Spomky
Copy link
Member

Spomky commented Mar 16, 2015

Thank.
I am sorry I did not notice the trailing "=" in my examples.
Please could you try again the first barcode?

I have also updated my library. It should work fine now (use the last dev-master release).
If it is correctly loaded, I will tag it as stable soon.

@ckr
Copy link
Author

ckr commented Mar 16, 2015

The second example works not the first. Thanks for the quick reply. Wouldn't not returning the algorithm=sha1, period=30 and digits=6 break other apps like FreeOTP? Maybe a second function generate google uri would be better?

@Spomky
Copy link
Member

Spomky commented Mar 16, 2015

You are right, it could break other apps.
I added a parameter on method getProvisioningUri: a boolean:

  • if true (default), $totp->getProvisioningUri(); (or $totp->getProvisioningUri(true);) produces URIs compatible with Google Authenticator by default.
  • if false, $totp->getProvisioningUri(false); will keep all parameters for compatibility with other apps

@rettal
Copy link

rettal commented Mar 17, 2015

Hi, I am working with @ckr on this. We have tested and it now works fine. Thank you for the quick fix.

Will this get auto-updated on Packagist?

Thanks again!

@Spomky
Copy link
Member

Spomky commented Mar 17, 2015

Hi,
I just release v4.0.2. It is already available via Packagist.

Thank for the report.

@Spomky Spomky closed this as completed Mar 17, 2015
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