I tinkered with admin/init a bit to see if I could pass it an existing token serial and get the json response that includes a QR code but I couldn't get it to work. Is this even possible?
URL url2 = new URL("http://localhost:5001/admin/init?description=web%20ui%20generated&user=${username}&realm=arya&pin=1234&otplen=6&genkey=1&type=totp&session=" + cookieValue)
URLConnection conn2 = url2.openConnection()
conn2.setRequestProperty("Cookie", cookie)
InputStream inputStream = conn2.inputStream
def response2 = JSON.parse(inputStream.newReader())
def img = response2.detail.googleurl.imgLook at your request and make sure you are setting the parameters correctly.Then look at the JSON you receive to extract the img.
Best regards.Madmous