Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@dyadikov/vue-vk-oauth2

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dyadikov/vue-vk-oauth2

unofficial vk openapi vue implementation

  • 1.0.6
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

npm

vue-vk-oauth2

Это обёртка VK Oauth для Vue2 https://vk.com/dev/openapi

github https://github.com/DenisYadikov/vue-vk-oauth2

Возможности
  1. Авторизация пользователя
  2. Вызов методов API ВКонтакте, список: https://vk.com/dev/methods
  3. Виджеты
Установка
npm i @dyadikov/vue-vk-oauth2
Подключение

Подключить пакет в проект, виджеты описываются опционально:

import VKAuth from '@dyadikov/vue-vk-oauth2'

new Vue(VKAuth, {apiId: YOUR_VK_APP_ID,
  widgets: [{
    widget: 'ContactUs',
    selector: 'vk_contact_us',
    props: {text: 'Задайте свой вопрос'}
  }]
})

После подключения вы можете обращаться к инстансу через глобальную переменную $vkAuth

Использование
<template>
  <div>
    <button @click="vkLogin">vkLogin</button>
    <button @click="vkLogout">vkLogout</button>
    <button @click="vkGetLoginStatus">vkGetLoginStatus</button>
    <button @click="vkRevokeGrants">vkRevokeGrants</button>
    <button @click="vkGetSession">vkGetSession</button>
    <button @click="vkApiMethodExample">vkApiMethodExample</button>
    <!-- VK Widget Example -->
    <div id="vk_contact_us"></div>
  </div>
</template>

...

<script>
import Vue from 'vue'
import VKAuth from '@dyadikov/vue-vk-oauth2'

new Vue(VKAuth, {apiId: YOUR_VK_APP_ID,
  widgets: [{
    widget: 'ContactUs',
    selector: 'vk_contact_us',
    props: {text: 'Задайте свой вопрос'}
  }]
})

export default {
  methods: {
    vkLogin () {
      this.$vkAuth.login()
        .then(response => {
          console.log('vklogin', response)
        })
        .catch(error => {
          console.error(error)
        })
    },
    vkLogout () {
      this.$vkAuth.logout()
        .then(response => {
          console.log('vklogout', response)
        })
        .catch(error => {
          console.error(error)
        })
    },
    vkGetLoginStatus () {
      this.$vkAuth.getLoginStatus()
        .then(response => {
          console.log(response)
        })
        .catch(error => {
          console.error(error)
        })
    },
    vkRevokeGrants () {
      this.$vkAuth.revokeGrants()
        .then(response => {
          console.log(response)
        })
        .catch(error => {
          console.error(error)
        })
    },
    vkGetSession () {
      this.$vkAuth.getSession()
        .then(response => {
          console.log(response)
        })
        .catch(error => {
          console.error(error)
        })
    },
    vkApiMethodExample () {
      this.$vkAuth.Api('users.get', {user_ids: VK_USER_ID, v: '5.73'})
        .then(response => {
          console.log(response)
        })
        .catch(error => {
          console.error(error)
        })
  }
}
<script>

Keywords

FAQs

Package last updated on 04 Aug 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc