pyauth / pyotp

Python One-Time Password Library
https://pyauth.github.io/pyotp/
Other
2.95k stars 321 forks source link

Wishlist: support provider image logo #96

Closed jonasbardino closed 3 years ago

jonasbardino commented 4 years ago

One or more authenticator apps have introduced support for provider logo images in the otp URIs: https://freeotp.github.io/ Basically relying on a non-standard image=PNGLOGOURL component in the URI.

There's a bit more background at https://stackoverflow.com/questions/41232168/token-image-in-google-authenticator-or-freeotp

It can of course be manually clamped onto the URI from provisioning_uri(...) but it's a bit tedious since PNGLOGOURL should probably be checked and must at least be properly URL-encoded:

...
otp_uri = totp.provisioning_uri(username, issuer_name)
otp_uri += '&image=%s' % urllib.quote(logo_url, '')

Would it be acceptable to integrate e.g. as a optional issuer_logo_url argument in provisioning_uri() ?

I already tried it out in practice and verified that e.g. Google Authenticator simply ignores the image parameter. So it shouldn't hurt, even though it currently doesn't show the logo.

kislyuk commented 3 years ago

Thanks. Yes, this would be good to have incorporated in provisioning_uri.

kislyuk commented 3 years ago

This has now been added courtesy of @ddboline in #113.