Socket
Book a DemoInstallSign in
Socket

cordova-vk

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cordova-vk

cordova/phonegap adapter for vksdk. iOS 9 compatible

latest
Source
npmnpm
Version
1.0.1
Version published
Maintainers
1
Created
Source

Cordova VK social network plugin

cordova/phonegap adapter for vksdk. iOS 9 compatible

You can use this plugin to authenticate user via VK application rather than via webview. It makes use of official VkSDKs for iOS and Android. This project is based on another github project https://github.com/DrMoriarty/cordova-social-vk . But Api was made a bit more generic to fit our needs.

Installation and Setup

First, you need to create VK application on developer page: https://vk.com/apps?act=manage

Android

cordova plugin add cordova-vk

Official VK documentation of how to setup and app is located here: https://vk.com/dev/android_sdk . Fill in Fill in the "Batch name for Android", "Main Activity for Android" and "Certificate fingerprint for Android" fields. To generate fingerprint once android app is installed and running you can use VkSdk.getFingerPrintVkSdk method like this: VkSdk.getFingerPrintVkSdk(function(fpt) { alert(fpt); });

iOS

cordova plugin add cordova-vk --variable VK_APP_ID=vk123456

Where vk123456 is unique identificator of your application, which you can see in your app settings: https://vk.com/editapp?id=123456 . Please note, that vk prefix should also be presented. This is needed to setup callback url scheme, so that VK application can open yours.

Sample usage

Upon your application startup you need to call VkSdk.init method with your APP id as an argument.

VkSdk.init('123456');

To initiate login process, you should call VkSdk.initiateLogin method:

VkSdk.initiateLogin(['photos', 'offline']);

As per SDKs' architecture receiving token is an event, rather than callback, you need to listen to vkSdk.newToken event to understand, when your user was logged in:

document.addEventListener('vkSdk.newToken', function(token) {
  console.log('New token is ' + token);
});

Important notes

Library is not complete. If you need bindings for some particular methods, create PRs or Issues. Thanks for your cooperation.

License

MIT

FAQs

Package last updated on 11 Jan 2016

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