'TOTP 2FA authorisation ReactJS frontend Flask backend, seeking advice

I successfully implemented a TOTP 2FA authorisation in Flask using Flask-Forms(User register -> gets QR-code). I want to do the same with a React frontend instead of Flask-Forms. What is the most sensible way to do this?

  1. Let the backend do the whole job to generate the QR-code and then display it in React as an image.(is that secure enough?)

  2. Let React generate the QR-Code and use the backend only to register the user.

  3. If anybody has an other better way is most welcome.

I would be happy if somebody could point me in the right direction.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source