{"action":"created","issue":{"url":"https://api.github.com/repos/scheb/two-factor-bundle/issues/118","repository_url":"https://api.github.com/repos/scheb/two-factor-bundle","labels_url":"https://api.github.com/repos/scheb/two-factor-bundle/issues/118/labels{/name}","comments_url":"https://api.github.com/repos/scheb/two-factor-bundle/issues/118/comments","events_url":"https://api.github.com/repos/scheb/two-factor-bundle/issues/118/events","html_url":"https://github.com/scheb/two-factor-bundle/issues/118","id":305327239,"number":118,"title":"Support Google Authenticator digit lengths != 6","user":{"login":"lstrojny","id":79707,"avatar_url":"https://avatars2.githubusercontent.com/u/79707?v=4","gravatar_id":"","url":"https://api.github.com/users/lstrojny","html_url":"https://github.com/lstrojny","followers_url":"https://api.github.com/users/lstrojny/followers","following_url":"https://api.github.com/users/lstrojny/following{/other_user}","gists_url":"https://api.github.com/users/lstrojny/gists{/gist_id}","starred_url":"https://api.github.com/users/lstrojny/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lstrojny/subscriptions","organizations_url":"https://api.github.com/users/lstrojny/orgs","repos_url":"https://api.github.com/users/lstrojny/repos","events_url":"https://api.github.com/users/lstrojny/events{/privacy}","received_events_url":"https://api.github.com/users/lstrojny/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-03-14T21:02:00Z","updated_at":"2018-03-14T21:47:57Z","closed_at":null,"author_association":"NONE","body":"The default number of digits for Google Authenticator is 6. The service `scheb_two_factor.security.google` takes number of digits as the first parameter in [two_factor_provider_google.xml](https://github.com/scheb/two-factor-bundle/blob/master/Resources/config/two_factor_provider_google.xml). The default is 6. Now if one wants to use more than 6 digits, one has to go through the followinf hoops:\r\n* Override `scheb_two_factor.security.google` to set the first constructor parameter to != 6\r\n* Use this patch: https://github.com/sonata-project/GoogleAuthenticator/pull/103\r\n* Modify `Scheb\\TwoFactorBundle\\Security\\TwoFactor\\Provider\\Google\\GoogleAuthenticator::getQRContent()` to append the `digits` parameter (according to https://github.com/google/google-authenticator/wiki/Key-Uri-Format, keep in mind the \"not yet implemented\" comment is incorrect, Google Authenticator supports the digits parameter nowadays)\r\n\r\nExample:\r\n```php\r\npublic function getQRContent(TwoFactorInterface $user): string\r\n{\r\n    return parent::getQRContent($user) . '&digits=' . $this->passCodeLength;\r\n}\r\n```\r\n\r\nIt would be nice if this could be a configuration setting. What do you think?"},"comment":{"url":"https://api.github.com/repos/scheb/two-factor-bundle/issues/comments/373186100","html_url":"https://github.com/scheb/two-factor-bundle/issues/118#issuecomment-373186100","issue_url":"https://api.github.com/repos/scheb/two-factor-bundle/issues/118","id":373186100,"user":{"login":"Spomky","id":1091072,"avatar_url":"https://avatars2.githubusercontent.com/u/1091072?v=4","gravatar_id":"","url":"https://api.github.com/users/Spomky","html_url":"https://github.com/Spomky","followers_url":"https://api.github.com/users/Spomky/followers","following_url":"https://api.github.com/users/Spomky/following{/other_user}","gists_url":"https://api.github.com/users/Spomky/gists{/gist_id}","starred_url":"https://api.github.com/users/Spomky/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Spomky/subscriptions","organizations_url":"https://api.github.com/users/Spomky/orgs","repos_url":"https://api.github.com/users/Spomky/repos","events_url":"https://api.github.com/users/Spomky/events{/privacy}","received_events_url":"https://api.github.com/users/Spomky/received_events","type":"User","site_admin":false},"created_at":"2018-03-14T21:47:57Z","updated_at":"2018-03-14T21:47:57Z","author_association":"NONE","body":"Hi @scheb,\r\n\r\nCould you please consider the use of another library: https://github.com/Spomky-Labs/otphp.\r\nIt offers support for a large range of digits (from 2 to .... whatever you want), large range of hash algorithms (in fact all the ones supported by PHP) and also additional features such as custom parameter.\r\n\r\nLet's give it a try. I will be happy to help you by writing a PR if you agree with that."}}
{"actor":{"display_login":"Spomky"}}