QR Code issue

Hello,

I’m trying to use MFA for one of my Streamlit app and running into issues with the QR code. Below is the code that is used to generate the QR code and displayed on the app screen. When I use the Google Authenticator app to scan the QR code, it throws error “Cannot interpret QR Code”.

What am I missing that will allow authenticator app to scan the QR Code? If I type the string assigned to data manually in authenticator, it adds the account and OTP verification is successful but QR code scan doesn’t works.

import streamlit as st
import otp, qr
import  pyqrcode
from io import BytesIO
from PIL import Image

data = 'OYHTVLO7TC5VGU2T'
qr = pyqrcode.create(data)
buffer = BytesIO()
qr.png(buffer, scale=4)
buffer.seek(0)
img = Image.open(buffer)
st.image(img) 

The below wiki page has the details on how to generate the QR code for Authenticator if anyone has similar issue. This help me resolve my issue.

Basically the data string had to change to:
otpauth://totp/{login}?secret={st.session_state.sec_key}&issuer=timetracker
vs. just using the string ‘OYHTVLO7TC5VGU2T’

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.