Authyo Docs
  1. Web SDKs
Authyo Docs
  • 🐶 Walk through Authyo
  • Error Codes
  • About Pricing
  • APIs
    • Send OTP
      GET
    • Send OTP
      POST
    • Verify OTP
      GET
    • Verify Token
      POST
  • Web SDKs
    • JavaScript
    • PHP
    • AngularJS Examples
    • TypeScript Examples
    • React JS
    • Vue JS Examples
  • Native/Mobile SDKs
    • Flutter
  1. Web SDKs

Vue JS Examples

JavaScript SDK

Vue.js Integration

Step 1: Add the Container

Add the Authyo container in your Vue template:

<template>
  <div id="authyo-sdk"></div>
</template>

Step 2: Load the SDK Script Dynamically

Inject the SDK script when the component mounts:

mounted() {
  const script = document.createElement("script");
  script.src = "https://app.authyo.io/js/v1/auth-sdk.js";
  script.setAttribute("data-appkey", "YOUR_APP_KEY");
  script.async = true;
  document.body.appendChild(script);
}

Step 3: Handle the Response

Use window.authyoResponse to capture success or failure:

mounted() {
  // Load SDK
  const script = document.createElement("script");
  script.src = "https://app.authyo.io/js/v1/auth-sdk.js";
  script.setAttribute("data-appkey", "YOUR_APP_KEY");
  script.async = true;
  document.body.appendChild(script);

// Capture response
window.authyoResponse = (response) => {
if (response.success) {
console.log("āœ… Verified:", response.data);
} else {
console.error("āŒ Error:", response.message);
}
};
}

Full Component Example

<template>
  <div id="authyo-sdk"></div>
</template>

<script>
export default {
name: "AuthyoWidget",
mounted() {
const script = document.createElement("script");
script.src = "https://app.authyo.io/js/v1/auth-sdk.js";
script.setAttribute("data-appkey", "123456-app-key-xyz");
script.async = true;
document.body.appendChild(script);
window.authyoResponse = (response) => {
if (response.success) {
console.log("āœ… User verified:", response.data);
} else {
console.error("āŒ Login failed:", response.message);
}
};

}
};

</script>

Customization (Auto-loaded from Dashboard)

  • āœ… Logo, Header, Body Text
  • āœ… Button Styles & Colors
  • āœ… Input Design
  • āœ… Social Button Layout
  • āœ… Branding & Links

Supported Login Methods

  • āœ… Email OTP
  • āœ… SMS / WhatsApp / Voicecall
  • āœ… QR Code Login
  • āœ… Google / Microsoft / LinkedIn / GitHub

Response Structure

{
  "success": true,
  "message": "OTP verified successfully",
  "status": "verified",
  "data": {
    "email": "abc@xyz.com"
  }
}

Troubleshooting

ProblemFix
Widget not loadingEnsure #authyo-sdk exists before SDK script
Blank widgetCheck that App Key is valid
No response callbackDefine window.authyoResponse
Wrong stylesAdjust design from dashboard
Modified atĀ 2025-08-23 07:37:01
Previous
React JS
Next
Native/Mobile SDKs
Built with