Odnoklassniki API client
Switch branches/tags
Nothing to show
Clone or download
cre-o Merge pull request #5 from romanbolshakov/master
Condition for access_token attribute
Latest commit 8a7b765 Dec 16, 2017
Type Name Latest commit message Commit time
Failed to load latest commit information.
lib remove access token from init requestData Dec 15, 2017
test Not used. Dec 1, 2013
README.md Readme update. Nov 12, 2013
index.js index. Nov 4, 2013
package.json updated dependecies Jul 31, 2014


Ok.ru API with node

This npm module allows you to simplify making API requests into odnoklassniki REST API.

Example usage

ok = require("ok.ru")

# Basic configuration params
requestOptions = {
  applicationSecretKey: '{secretKey}',
  applicationKey: '{applicationKey}',
  applicationId: '{applicationId}',

# You can specify accessToken in requestOptions or separately
# For example: if you have many users and you whant to iterate through them

# All data passed in Object
ok.post { method: 'group.getUserGroupsV2' }, (err, data) ->
  # Some actions with data

# You can also specify types of requests
ok.post, ok.get

# Or pass in, as argument
new ok.api 'get', { method: 'users.isAppUser' }, (err, data) ->
  # some actions with data

# It properly handle errors
ok.setAccessToken('invalid_token') # Invalid token

new ok.api 'get', { method: 'users.isAppUser' }, (err, data, response) ->
  # some actions with data
  alert "Alarm! Error! #{err}" if err?
  # It can transport all response and headers
  console.log response

Refresh user token method

ok.refresh '{refresh_token}', (err, data) ->
  data.access_token # new token

Test it!

Add your params at test/settings.yml and you are ready to go!
$ mocha



  • What do you need? Let me know or fork.