TwoFactorAuth.Net icon indicating copy to clipboard operation
TwoFactorAuth.Net copied to clipboard

QRCodeProvider - make GetUri public

Open alex-jitbit opened this issue 4 years ago • 4 comments

To prevent the extra hop of downloading QR-image from the provider and then transferring it to the the client again - allow us to insert the URL into client's HTML directly.

Also your code for the default provider is the not most efficeint one (uses webclient - no connection caching, no async call etc, bu that's another issue)

alex-jitbit avatar Oct 25 '21 19:10 alex-jitbit

To prevent the extra hop of downloading QR-image from the provider and then transferring it to the the client again - allow us to insert the URL into client's HTML directly.

I'm not quite sure I understand. Could you give an example? The GetUri method appears 3 times in the code, and each time it's specific to that specific provider.

Also your code for the default provider is the not most efficeint one (uses webclient - no connection caching, no async call etc, bu that's another issue)

Yeah, I haven't come around to making it async and use a propery HttpClient / DI.

RobThree avatar Oct 25 '21 19:10 RobThree

I'm not quite sure I understand. Could you give an example?

Sorry I wasn't clear.

The QR code providers that rely on 3rd party services first download the code from that service (e.g. image-charts) and then I can insert the resulting data-uri into my app's HTML.

How about allowing us to inserting the 3rd party image-generating API URL into html directly, so it's the client's browser that downloads the image, not my backend server?

<img src='@tfa.Something.GetUri()>

which would render

<img src='https://image-charts.com/chart?cht=qr&.....'>

alex-jitbit avatar Oct 25 '21 19:10 alex-jitbit

BTW treat this as a low priority feature request and feel free to close ;)

alex-jitbit avatar Oct 25 '21 19:10 alex-jitbit

BTW treat this as a low priority feature request and feel free to close ;)

No, it's about time I give this project a bit of love again. I'll see what I can do; no promises (yet) though 😉

RobThree avatar Oct 26 '21 10:10 RobThree