Skip to content
Advertisement

Display QRCode in HTML (google authenticator)

I made a POST request to get a QRCode Here is the data I get from the response. The preview of the response works fine only I don’t know how to use this data to display it in a tag on my html page for example. Any ideas?

enter image description here

Advertisement

Answer

It finally works as : (in async function)

 const response = await fetch(URL_FOR_QRCODE, //your own url
  {
    method: "POST", //because my endpoint is a post method
    credentials: 'include' //because I use cookies (its a auth qr code)
  });

  this.QRCodeSRC = URL.createObjectURL(await response.blob());
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement