Add the Authyo container in your Vue template:
<template>
<div id="authyo-2fasdk"></div>
</template>
Inject the SDK script when the component mounts:
mounted() {
const script = document.createElement("script");
script.src = "https://app.authyo.io/js/v1/auth-2fasdk.js";
script.setAttribute("data-appkey", "YOUR_APP_KEY");
script.setAttribute("data-appkey", "abc@xyz.com");
script.async = true;
document.body.appendChild(script);
}
Handle success or failure using window.authyoResponse
:
<script>
window.authyoResponse = function(response) {
if (response.success) {
alert('Success: ' + response.message);
} else {
alert('Error: ' + response.message);
}
};
</script>
{ "success": true, "IsTOtpVerified": false, "message": "ok" }
{ "success": true, "message": "qrcode generated successfully", "QRCoder": "data:image/png;base64,....", "maskId": "optional" }
{ "success": true, "message": "verified" }
{ "success": true, "message": "2FA disabled" }
Problem | Fix |
---|---|
Widget not loading | Ensure #authyo-2fasdk div exists before the script |
Blank screen | Ensure valid data-appkey and data-emailid is used |
No response callback | Implement window.authyoResponse |
Styling off | Check App Key design settings in dashboard |