When implementing 2FA it's a bad idea to generate the QR image containing the TOTP secret using Google charts:
<img src="https://chart.googleapis.com/
chart?chl=otpauth%3A%2F%2Ftotp%2F...secret%3Dacl...mwv&chs=200x200&cht=qr" />
Google tracks all your internet moves and could easily exploit this vulnerability to bypass 2FA:
- Google knows the email associated with the user generating the QR code (cookies everywhere)
- Google receives a
Referer
from your browser when the QR image is generated, so it knows where the TOTP can be used
Add those two facts with a potential password re-use between Gmail and your 2FA-"protected" application and you have something really bad in your hands.