0.2.0 • Published 1 year ago
x-vue-login v0.2.0
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>