nuxt-telegram-auth
TypeScript icon, indicating that this package has built-in type declarations

1.2.0Β β€’Β PublicΒ β€’Β Published

πŸ” A telegram login widget integration for nuxt 3


Documentation

  • πŸ§‘β€πŸ’» Easy Integration - A telegram bot and this module enough for telegram login widget

Installation:

npx nuxi module add nuxt-telegram-auth

Then you need add TELEGRAM_TOKEN to your runtimeConfig:

runtimeConfig: {
  TELEGRAM_TOKEN: "my_fancy_bot_token",
}

after that you can try on a page:

<template>
  <div>
    <div>
      <div v-if="session.loggedIn">
        <NuxtLink @click="logout" to="/">Logout</NuxtLink>
        <a>Hey you are logged in!</a>
        <p>Session: {{ session }}</p>
      </div>
      <div v-else>
        <TelegramLoginWidget telegram-login="my_bot" @callback="testCallback" />
      </div>
    </div>
  </div>
</template>

<script setup>
const { clearSession, session } = useUserSession();
const logout = () => clearSession();
const testCallback = (user) => {
  console.log("Custom callback function: ",user);
};
</script>

for more detailed information, please check the documentation page.

MIT LICENSE | Halit Sever

Readme

Keywords

none

Package Sidebar

Install

npm i nuxt-telegram-auth

Weekly Downloads

29

Version

1.2.0

License

MIT

Unpacked Size

11.7 kB

Total Files

20

Last publish

Collaborators

  • halitsever