PHPGangsta / GoogleAuthenticator

PHP class to generate and verify Google Authenticator 2-factor authentication
http://phpgangsta.de/4376
BSD 2-Clause "Simplified" License
2.26k stars 698 forks source link

Fixed bug that malformes QR URL #1

Closed edwardmp closed 12 years ago

edwardmp commented 12 years ago

Hi,

I've just spent 2 hours trying to figure out why my QR wouldn't show. If I visited the Google URL, it said it was malformed.

The problem the person is having here: http://stackoverflow.com/questions/11074191/google-2-factor-authentication-qr-code-issues is about the same problem I was having.

I eventually fixed this problem my applying a proper urlencode (yours was partially encoded already, but you forgot the user defined variables) and secondly by changing the URL from google.com to chart.googleapis.com. Don't ask me why but the latter seems to be working better.

Good luck and thanks for making this plugin!

LavaToaster commented 12 years ago

Shouldn't that be up to the coder using this to make sure that the variables are passed through urlencoded?

edwardmp commented 12 years ago

No, or else it should be made clearly in the README. This is such a trivial problem, it wouldn't harm to add 1 line of code to make sure it is encoded correctly.

PHPGangsta commented 12 years ago

Thank you. I also had problems with the old URL (got 400 Bad Request), with your change it works again.

edwardmp commented 12 years ago

Great!