RobThree / TwoFactorAuth.Net

.Net library for Two Factor Authentication (TFA / 2FA)
MIT License
338 stars 59 forks source link

Google's QR generator has gone dark. It should no longer be the default. #9

Closed GeekyMonkey closed 5 years ago

GeekyMonkey commented 5 years ago

https://groups.google.com/forum/#!topic/google-chart-api/rZtHTyYgyXI

I've switched to one of the alternate providers to get our websites back in business. The google one should no longer be the default.

It would be nice if we could configure multiple providers, and on failure go to the next available option. Even better would be not having that external dependency.

RobThree commented 5 years ago

I've switched to one of the alternate providers to get our websites back in business. The google one should no longer be the default.

I'll pick a new default.

Edit: Having looked into it; I guess I'll rename the GoogleQrCodeProvider to ImageChartsQrCodeProvider and have it use https://www.image-charts.com. Least amount of work and as a bonus we don't really "lose" a QrCodeProvider.

It would be nice if we could configure multiple providers, and on failure go to the next available option.

If I were you I'd implement ANOTHER provider; let's call it a FallbackProvider; this could simply implement IQrCodeProvider and have an IEnumerable<IQrCodeProvider> provided in it's constructor. The implementation could then do all the work trying underlying providers, trying the next on failure etc. Shouldn't be hard to implement.

Even better would be not having that external dependency.

No problem. You can implement your own. Simply pick any QR library and have it generate the images for you.

GeekyMonkey commented 5 years ago

Thanks Rob. Sounds like you got it covered.

RobThree commented 5 years ago

See 1.3.6 and this commit

GeekyMonkey commented 5 years ago

Thanks for the quick turnaround on that Rob. To remove the risk of the API going dark again, I followed your advice and implemented a QR Code provider that doesn't need to call an API. I chose SkiaSharp because I'm deploying to Linux/Docker and this didn't require any extra libs to be installed there.

I've made my provider available as a NuGet package in case anyone else would like to use it. Feel free to link in your docs.

NuGet GitHub

RobThree commented 5 years ago

I've created a wiki and referred to it from the README.

Thanks for the heads-up on the issue and thanks for your implementation! 👊