vue-web-otp

Verify phone numbers on the vue web applications
2,708 4
Install
npm install vue-web-otp
Latest Version:1.0.1
Vue:3
Older releases:2
License:MIT
Last Updated:Aug 8, 2023
Links: GitHub  ·  npm
Maintainer: mohamadhassan98

vue-web-otp

Verify phone numbers on the vue web applications

Overview

This library is a wrapper around WebOTP API for Vue web applications. The WebOTP API lets your app receive specially-formatted messages bound to your app's domain. From this, you can programmatically obtain an OTP from an SMS message and verify a phone number for the user more easily. Full WebOTP API documentation Here.

There is a DEMO available.

Install and usage

To use it inside a vue 2 project, checkout vue-2 branch.

Install using npm

npm install --save vue-web-otp

or Yarn

yarn add vue-web-otp

Import component and use it!

<script setup lang="ts">
import { VueWebOtp } from 'vue-web-otp';
import { ref } from 'vue';

const webOtp = ref<InstanceType<typeof VueWebOtp> | null>(null);
</script>

Example of usage in App.vue or any other Vue component:

<vue-web-otp ref="webOtp" @input="otpInput = $event">
  <template #default="{ autocomplete }">
    <input
      v-model="otpInput"
      :autocomplete="autocomplete"
    />
  </template>
</vue-web-otp>

Note that this setup waits for the formatted message to fill the input. However, sometimes you may want to abort the listener (for example, if the user entered the code manually). For this, you can call the abort method available on the component, like this:

function stopWaiting() {
  webOtp?.abort();
}

Project setup

yarn

Compiles and hot-reloads for development

yarn dev

Compiles and minifies for production

yarn build

Preview production built project in browser

yarn preview

Contributions

Feel free to fix bugs and suggest new features via PRs.

Related Packages

@cubis/verifyme

Verifyme SDK for JavaScript and TypeScript: send and verify one-time codes over...

482
vue-input-otp

https://github.com/wobsoriano/vue-input-otp/assets/13049130/c5080f41-f411-4d38-a...

4,200,094 90
@altgr4m/vue3-one-time-password

Customizable OTP (One Time Password) is a 23kB lightweight component for web app...

1,349 0
@k-otp/sdk

Official K-OTP (Korean OTP API) SDK: issue and verify one-time passwords from br...

1,010 0
@bachdgvn/vue-otp-input

A fully customizable, one-time password input component for the web built with V...

202,248 125

Version History

Version Released Vue License
1.0.1 ^3.2.47 MIT
1.0.0 ^3.2.47 MIT
0.1.2 ^2.6.11 MIT
0.1.1 ^2.6.11 MIT
0.1.0 ^2.6.11 MIT