External JavaScript SDK

General information

This is a deprecated SDK that is recommended for usage only for native standalone games and external sites
For games and applications launched from OK please consider using multiplatform SDK

Github repository: ok-js-sdk

App examples using SDK: ok-js-sdk/samples

External JavaScript SDK is intended to be used in MOBILE_HTML games distributed on our mobile platforms and in standalone external applications.

With this SDK you can:

Setting up and configuring SDK

Before setting up External SDK check your application’s settings:

  • MOBILE_HTML or External platform should be enabled;
  • for MOBILE_HTML apps:
    • callback url must be specified for payments to work correctly;
  • for External apps:
    • client OAuth authorization is enabled;
    • redirect_uri field contains an url that will be used for authorization process;
    • all required permissions are enabled. It is highly recommended to enable LONG_ACCESS_TOKEN permission for native IOS and Android applications.

To enable External SDK in your project you need to:

  • copy oksdk.js file from repository to your project;

  • enable this script on your page, i.e:

<script type="text/javascript" src="oksdk.js"></script>

Using SDK

SDK initialization

This method must be invoked once before using any other SDK method (i.e. on app launch).

OK REST API

In-app payments

In-app video ads

Widgets

Utility methods