x-vue-login
TypeScript icon, indicating that this package has built-in type declarations

0.2.0 • Public • Published

Vue3 X.online Login

Installation

Install with npm:

$ npm i vue3-x-login

Usage

Import xLoginWidget, pass it to the components and use in your template

<template>
  <!-- Callback mode -->
  <span v-if="!isLoaded">Loading...</span>
  <xLoginWidget mode="callback" x-login="YourXBot" @loaded="xLoadedCallbackFunc" @callback="yourCallbackFunction" />

  <!-- Redirect mode -->
  <xLoginWidget mode="redirect" x-login="YourXBot" @loaded="xLoadedCallbackFunc" redirect-url="https://example.com" />
</template>

<script setup>
import { xLoginWidget } from 'vue3-x-login'
import { ref } from 'vue'

const isLoaded = ref(false)

function xLoadedCallbackFunc() {
  console.log('Auth widget is loaded')
  isLoaded.value = true
}

function yourCallbackFunction(user) {
  // gets user as an input
  // id, first_name, username, avatar and hash
  console.log(user)
}
</script>

Package Sidebar

Install

npm i x-vue-login

Weekly Downloads

5

Version

0.2.0

License

MIT

Unpacked Size

7.16 kB

Total Files

6

Last publish

Collaborators

  • yablonev