# vkauth

> Authentication module for vk.com

Latest version **1.0.1** (published 2016-01-06) · ISC license · 0 weekly downloads

## Install

```sh
npm install vkauth
pnpm add vkauth
yarn add vkauth
bun add vkauth
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2016-01-06 |
| First published | 2016-01-06 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Maintainers | starwars25 |
| Keywords | vk.com, vk, vkontakte |

## Links

- npm: https://www.npmjs.com/package/vkauth
- Repository: https://github.com/starwars25/vkauth
- Homepage: https://github.com/starwars25/vkauth#readme
- Issues: https://github.com/starwars25/vkauth/issues
- npm.io page: https://npm.io/package/vkauth

## Recent versions

- 1.0.1 (latest) — 2016-01-06
- 1.0.0 — 2016-01-06

## README

# VK Auth
## Description

This module for [Express.js](http://expressjs.com/) will help you get server [VK](http://vk.com) access token. After that you can use it to create your authentication system which uses **VK**. After gaining access token you can use it in other **VK API** modules. You can also easily get OAuth URL based on your settings with handy `getUrl()` method. 

## Installation

Just run `npm install vkauth --save`.

## Configuring

Example of using:

```javascript
var vkauth = require('./vkauth');
vkauth.config.client_id = Number(process.env['VK_CLIENT_ID']);
vkauth.config.app_secret = process.env['VK_APP_SECRET'];
vkauth.config.host = 'localhost:3000';
vkauth.config.route = '/token';
vkauth.config.scope = ['friends'];
```

Description:

* `client_id` - Client Id of your app;
* `app_secret` - Secret key of your app;
* `host` - Host of your application;
* `route` - Route where you want to get access token;
* `scope` - Array of permissions of your app.

You also can specify version of API using `v` property. Set it as `String`.

## Using

Example:

```javascript
vkauth.start(app, function(res, err, token) {
    if (err) {
        console.log(err);
    } else {
        console.log(token);
        res.json(token);
    }
});
```

* `app` - `Express.js` instance;
* `res` - `Response` object;
* `err` - Error, will be `null` if there is no error;
* `token` - `access_token` object, will be null, if there is an error.

`token` object:

* `token.access_token` - access token;
* `token.user_id` - user id;
* `token.expires_in` - expiration time in seconds.

You can get **VK API URL** based on `config` object using method `vkauth.getUrl()`.

---
_Source: https://npm.io/package/vkauth · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
