By ZooGamesID

Two-Factor Authentication

Concept

The player provides their ZooGamesID and 2FA token, and if the credentials are valid, the server grants access for the user to log in.

A user's session in the application has an expiration time of 120 minutes. After this period, the session will expire, and the user will need to log in again.

If the user wants to extend the session and prevent it from expiring, they can use the Keep-alive API. By making a request to the Keep-alive API within the session's duration, the session will be refreshed, and the expiration time will be extended.

To gain insights into how authentication works on Zoo.Games, you can explore our open-source Telegram AUTH web app. It will provide you with a clear understanding of the authentication process implemented on the Zoo.Games platform.

pageZooGames AUTH webapp for Telegram

To ensure compatibility with the API, please note that only lowercase ZooGamesIDs are supported. When communicating with the API, please convert any uppercase letters in the ZooGames ID to lowercase. You can maintain the appearance of capital letters in your game, but the actual communication with the API should use lowercase characters.

To authenticate and handle login and logout functionality, you need to follow these steps:

Login and Logout

by installing the SDK and utilizing the signData() function, you can generate the SignedSignatureFromPayload (HMAC signature) for authentication purposes in the ZooGames API requests

Login API - To Login user and return JWT token as a session token

POST API_END_POINT_URL/API_KEY/session/login

SDK Preparation

You need to prepare for SignedSignatureFromPayload by

Installing zoo-game-sdk by npm install zoo-game-sdk

Import SDK by import * as ApiKey from 'zoo-game-sdk/src/auth/apikey/index'

Signing by SDK

let bodyMessage =JSON.stringify(payload);

let hmac = ApiKey.signData(bodyMessage, SEC_KEY);

*Use "hmac" as SignedSignatureFromPayload

Path Parameters

NameTypeDescription

API_KEY*

String

API Key

Headers

NameTypeDescription

authorization*

String

eg: Bearer SignedSignatureFromPayload

Request Body

NameTypeDescription

username*

String

ZooGamesId

token*

String

6 digits of 2FA token

{
  "success": true,
  "data": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6ImNyeXB0b2Zlbm5lYyIsInByaW1hcnlBZGRyZXNzIjoiMHg2QWI0OTljOEUyZjNDQmM5Qzk5MDM0YjZlMjkxMjE0OTIxMmJFNzcwIiwibWlycm9yQWRkcmVzcyI6IjB4ZTQyNzQxZjI4ZTE1YzU4NzkxMjlGZTVGNzQ5Zjc4NjIzZWU3MTIzNiIsIm1pcnJvckJhbGFuY2UiOiI1NTUuMSIsImNoYWluSWQiOiI4ODgiLCJ2ZXJpZnkyRkFTdWNjZXNzVGltZXMiOjQsImlhdCI6MTY1NjMxMTc4MH0.4EzwI54lVs_9zx2Qy-UhDsVb5PocHIDjxK0cCIxEZko"
}
Example of Login
import * as ApiKey from 'zoo-game-sdk/src/auth/apikey/index'
import axios from 'axios';

// Initialized API KEY and SECRET KEY
const API_KEY = 'YourApiKey';
const SEC_KEY = 'YourSecretKey';

// Signing body data with HMAC signing
let body = {username: "myusername", token: "123456"};
let bodyMessage = JSON.stringify(body); 
let hmac = ApiKey.signData(bodyMessage, SEC_KEY); // hmac or SignedSignatureFromPayload  

// Request by Post Method //
let ret = await axios.post(`/api/${API_KEY}/session/login`, body, {headers:{Authorization: `Bearer ${hmac}`}});
console.log('ret', ret.data);

IMPORTANT NOTICE: If a player is authenticated through the PlayPass account, Avoid logging the user out. Such an action can result in the permanent loss of the users linked digital assets.

Logout API - To log out for already log in user

POST API_END_POINT_URL/API_KEY/session/logout

SDK Preparation

You need to prepare for SignedSignatureFromPayload by

Installing zoo-game-sdk by npm install zoo-game-sdk

Import SDK by import * as ApiKey from 'zoo-game-sdk/src/auth/apikey/index'

Signing by SDK

let bodyMessage =JSON.stringify(payload);

let hmac = ApiKey.signData(bodyMessage, SEC_KEY);

*Use "hmac" as SignedSignatureFromPayload

Path Parameters

NameTypeDescription

API_KEY*

String

API Key

Headers

NameTypeDescription

authorization*

String

Bearer SignedSignatureFromPayload

Request Body

NameTypeDescription

jwt*

String

JWT token you got from Login API

{
  "success": true
}
Example of Logout
import * as ApiKey from 'zoo-game-sdk/src/auth/apikey/index'
import axios from 'axios';

// Initialized API KEY and SECRET KEY
const API_KEY = 'YourApiKey';
const SEC_KEY = 'YourSecretKey';

// Signing body data with HMAC signing
let body = {jwt: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6ImNyeXB0b2Zlbm5lYyIsInByaW1hcnlBZGRyZXNzIjoiMHg2QWI0OTljOEUyZjNDQmM5Qzk5MDM0YjZlMjkxMjE0OTIxMmJFNzcwIiwibWlycm9yQWRkcmVzcyI6IjB4ZTQyNzQxZjI4ZTE1YzU4NzkxMjlGZTVGNzQ5Zjc4NjIzZWU3MTIzNiIsIm1pcnJvckJhbGFuY2UiOiI1NTUuMSIsImNoYWluSWQiOiI4ODgiLCJ2ZXJpZnkyRkFTdWNjZXNzVGltZXMiOjQsImlhdCI6MTY1NjMxMTc4MH0.4EzwI54lVs_9zx2Qy-UhDsVb5PocHIDjxK0cCIxEZko"};
let bodyMessage = JSON.stringify(body); 
let hmac = ApiKey.signData(bodyMessage, SEC_KEY); // hmac or SignedSignatureFromPayload  

// Request by Post Method //
let ret = await axios.post(`/api/${API_KEY}/session/logout`, body, {headers:{Authorization: `Bearer ${hmac}`}});
console.log('ret', ret.data);

Keep-alive

The Keep-Alive feature allows users to extend the expiration time of their session. By making a request to the Keep-Alive API endpoint within the session duration, users can refresh the session and prevent it from expiring.

Keep-alive API - To keep alive (Persistent Session) logged in user

POST API_END_POINT_URL/API_KEY/session/keepAlive

SDK Preparation

You need to prepare for SignedSignatureFromPayload by

Installing zoo-game-sdk by npm install zoo-game-sdk

Import SDK by import * as ApiKey from 'zoo-game-sdk/src/auth/apikey/index'

Signing by SDK

let bodyMessage =JSON.stringify(payload);

let hmac = ApiKey.signData(bodyMessage, SEC_KEY);

*Use "hmac" as SignedSignatureFromPayload

Path Parameters

NameTypeDescription

API_KEY*

String

API Key

Headers

NameTypeDescription

authorization*

String

eg: Bearer SignedSignatureFromPayload

Request Body

NameTypeDescription

username*

String

ZooGameId

jwt*

String

JWT token you get from Login API

{
  "success": true,
  "data": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6ImNyeXB0b2Zlbm5lYyIsInByaW1hcnlBZGRyZXNzIjoiMHg2QWI0OTljOEUyZjNDQmM5Qzk5MDM0YjZlMjkxMjE0OTIxMmJFNzcwIiwibWlycm9yQWRkcmVzcyI6IjB4ZTQyNzQxZjI4ZTE1YzU4NzkxMjlGZTVGNzQ5Zjc4NjIzZWU3MTIzNiIsIm1pcnJvckJhbGFuY2UiOiI1NTUuMSIsImNoYWluSWQiOiI4ODgiLCJ2ZXJpZnkyRkFTdWNjZXNzVGltZXMiOjQsImlhdCI6MTY1NjMxMTc4MH0.4EzwI54lVs_9zx2Qy-UhDsVb5PocHIDjxK0cCIxEZko"
}
Example of Keep-alive
import * as ApiKey from 'zoo-game-sdk/src/auth/apikey/index'
import axios from 'axios';

// Initialized API KEY and SECRET KEY
const API_KEY = 'YourApiKey';
const SEC_KEY = 'YourSecretKey';

// Signing body data with HMAC signing
let body = {username: "myusername", jwt: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6ImNyeXB0b2Zlbm5lYyIsInByaW1hcnlBZGRyZXNzIjoiMHg2QWI0OTljOEUyZjNDQmM5Qzk5MDM0YjZlMjkxMjE0OTIxMmJFNzcwIiwibWlycm9yQWRkcmVzcyI6IjB4ZTQyNzQxZjI4ZTE1YzU4NzkxMjlGZTVGNzQ5Zjc4NjIzZWU3MTIzNiIsIm1pcnJvckJhbGFuY2UiOiI1NTUuMSIsImNoYWluSWQiOiI4ODgiLCJ2ZXJpZnkyRkFTdWNjZXNzVGltZXMiOjQsImlhdCI6MTY1NjMxMTc4MH0.4EzwI54lVs_9zx2Qy-UhDsVb5PocHIDjxK0cCIxEZko"};
let bodyMessage = JSON.stringify(body); 
let hmac = ApiKey.signData(bodyMessage, SEC_KEY); // hmac or SignedSignatureFromPayload  

// Request by Post Method //
let ret = await axios.post(`/api/${API_KEY}/session/keepAlive`, body, {headers:{Authorization: `Bearer ${hmac}`}});
console.log('ret', ret.data);

Keep-Alive helps enhance user experience by reducing the need for repeated logins and provides convenience during extended usage periods.

Approve

Approve API enables the creation of in-game vZOO transactions. However, to ensure security and validate the transaction, players are required to re-enter their 2FA (Two-Factor Authentication) credentials.

If the 2FA validation fails or is not provided by the player, the transaction will not be approved and will result in a failure.

Approve API - To request vZOO spending from user mirror address

POST API_END_POINT_URL/API_KEY/session/approve

SDK Preparation

You need to prepare for SignedSignatureFromPayload by

Installing zoo-game-sdk by npm install zoo-game-sdk

Import SDK by import * as ApiKey from 'zoo-game-sdk/src/auth/apikey/index'

Signing by SDK

let bodyMessage =JSON.stringify(payload);

let hmac = ApiKey.signData(bodyMessage, SEC_KEY);

*Use "hmac" as SignedSignatureFromPayload

Path Parameters

NameTypeDescription

API_KEY*

String

API Key

Headers

NameTypeDescription

authorization*

String

Bearer SignedSignatureFromPayload

Request Body

NameTypeDescription

username*

String

ZooGamesId

jwt*

String

JWT token you got from Login API

approval*

Decimal

vZOO amount for approval (e.g. 0.1)

playSeconds*

Integer

approval expiry in (e.g. 3600)

gameAddress

Address

Address of Game/Project registered Primary Address

token*

String

6 digits of 2FA token

{
    "success":true,     
    "data":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6ImNyeXB0b2Zlbm5lY3Rlc3QiLCJwcmltYXJ5QWRkcmVzcyI6IjB4NUQyQThCMzY4MzI5MjQ0MmZBQ2E1MmU5QjY1MzdGYWFhZDBBRTU3NiIsIm1pcnJvckFkZHJlc3MiOiIweDkxNGUwQ0U0RjQxMzJlQWM4OEMxNDViNkIyOTQ1MTIwNTZCYkZFMzkiLCJtaXJyb3JCYWxhbmNlIjoiNjAuMzUiLCJjaGFpbklkIjo5OTksInZlcmlmeTJGQVN1Y2Nlc3NUaW1lcyI6NCwiY3JlYXRlVGltZSI6MTY1NzA4ODk4MTc5NiwiYXZhdGFyIjoiZGF0YTppbWFnZS9qcGVnO2Jhc2U2NCwvOWovNEFBUVNrWkpSZ0FCQVFBQUFRQUJBQUQvNGdJb1NVTkRYMUJTVDBaSlRFVUFBUUVBQUFJWUFBQUFBQVF3QUFCdGJuU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DZTUzNThDRmlPMW5yRzhucWFhb25jY1lMYVNIQlA4b3l2Umo0MlNERDJodzlhdHgwc0VYMWNMRytBVU13eVhBY0d1dGtUbjI4d25BOHRGZ2JMejVCb1RXdDdlSFQwdFFRZCszVnpZOXhPZmNwK2c2Rkx0S0FhMjZRUWQ3WW1GNTh6aGRwRzdncXAwUnk1Rjl1Z3QzdXVDUVZ6ZWk2RmJIQ1E2cnE2dXBQTWJZYVBjTSs5VDFGMGE2VG9nTm0weFNFYzVzeWYzRXJha1MvRHNPMFNmbWUyU0xyRXBiVlFVVFEybG80WVdqa3hnYjhGbEJyUndBSHNWVVhiSVkyYkxRUGtpNVJFUk9wRVJFUWhFUkVJVVJwclV0djFQYVlhNmltWVh1YU90aDJ1MUU3bTBqang1ODFMb2lFSWlJaENJaUlRaUlpRUlpSWhDSWlJUWlJaUVLTDFEcUczNmJ0VTFmWHpzWnNOSmpqTHUxSzdrMW81NVBseEtJaUVMLy8yUT09IiwiaWF0IjoxNjYxNzg5ODc5LCJhcHByb3ZhbCI6IjAuMSIsInBsYXlTZWNvbmRzIjoiMzYwMCIsInN0YXJ0VGltZSI6MTY2MTc5MDAxNSwiZW5kVGltZSI6MTY2MTc5MzYxNSwiZ2FtZUFkZHJlc3MiOiIweDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAifQ.TF0AqIniXLg7rEhVOurFnM7MrTTvosXCYpVn0oorgBc"
}
Example of Approve
import * as ApiKey from 'zoo-game-sdk/src/auth/apikey/index'
import axios from 'axios';

// Initialized API KEY and SECRET KEY
const API_KEY = 'YourApiKey';
const SEC_KEY = 'YourSecretKey';

// Signing body data with HMAC signing
let body = {username: "myusername", "token":"123456", jwt: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6ImNyeXB0b2Zlbm5lYyIsInByaW1hcnlBZGRyZXNzIjoiMHg2QWI0OTljOEUyZjNDQmM5Qzk5MDM0YjZlMjkxMjE0OTIxMmJFNzcwIiwibWlycm9yQWRkcmVzcyI6IjB4ZTQyNzQxZjI4ZTE1YzU4NzkxMjlGZTVGNzQ5Zjc4NjIzZWU3MTIzNiIsIm1pcnJvckJhbGFuY2UiOiI1NTUuMSIsImNoYWluSWQiOiI4ODgiLCJ2ZXJpZnkyRkFTdWNjZXNzVGltZXMiOjQsImlhdCI6MTY1NjMxMTc4MH0.4EzwI54lVs_9zx2Qy-UhDsVb5PocHIDjxK0cCIxEZko","approval":0.1,"playSeconds":3600,"gameAddress": "0xd207d371d7a24F65cE9CcB3C78B58f27DF279Eb2"};
let bodyMessage = JSON.stringify(body); 
let hmac = ApiKey.signData(bodyMessage, SEC_KEY); // hmac or SignedSignatureFromPayload  

// Request by Post Method //
let ret = await axios.post(`/api/${API_KEY}/session/approve`, body, {headers:{Authorization: `Bearer ${hmac}`}});
console.log('ret', ret.data);

Status

The Status API returns the current JWT Payload and verifies whether their JWT is eligible for use in the Settlement API.

Status API - Returns current JWT Payload and verifies current JWT

POST API_END_POINT_URL/API_KEY/session/status

SDK Preparation

You need to prepare for SignedSignatureFromPayload by

Installing zoo-game-sdk by npm install zoo-game-sdk

Import SDK by import * as ApiKey from 'zoo-game-sdk/src/auth/apikey/index'

Signing by SDK

let bodyMessage =JSON.stringify(payload);

let hmac = ApiKey.signData(bodyMessage, SEC_KEY);

*Use "hmac" as SignedSignatureFromPayload

Path Parameters

NameTypeDescription

API_KEY*

String

API Key

Headers

NameTypeDescription

authorization*

String

Bearer SignedSignatureFromPayload

Request Body

NameTypeDescription

jwt*

String

JWT token you got from Login API

{
    "success":true,
    "data":
        {
            "username":"zoogametester",
            "primaryAddress":"0x8D2A8B3683292442fACa52e9B6537Faaad0AE765",
            "mirrorAddress":"0x524e0CE4F4132eAc88C145b6B294512056BbFE23",
            "mirrorBalance":"55.55",
            "chainId":999,
            "verify2FASuccessTimes":3,
            "createTime":1657088981796,
            "avatar":"data:image/jpeg;base64,/9j/4AAQSkZJRgABA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nIf44T8yB6qSzQoH8koHQE+isa/p5fQ6WYteAWPj3ggbjtD4nyW+aOorTqro7oKWrpo5o2RCJzXD6Lm7ifUd2cjvXKbxrO56jjbSTRxvYH7bY4Yd+fHeea3Togdd7bPV0dZbqqGhm+cjkliLWtdwI394x/Kqitc14a+YAWOV+PA4Ygm+HBXEMYjGo0kiwxtbJRmqeim42jbq7E99XTA7Xo7j84z+E/a+PitOuOorxcqCK1Vk8krYJOyx47e1wAJ4nG/ivTpAIwRkKAuGirLcL1TXeSkYKqneHh43bRHDa78cRnuSuEse7XAy4j39eqdHLC6wujrSw01p2NszAKyo+cnPcT9n2Dd5rbVQAAADgFVPwx+G2xzzPX39khREROpEVmrpYa2lkpqiNskcjS1zXDIIPEFXkXL2Ne0tdkULz5q/Rl00ZeBX2wTGja/bhnjyTCe5358CFiO1nrG8nqaaonccYLaSHBP8oyvRj42SDD2hw9atx0sEX1cLG+AUMwyXAcGutkTn28wnA8tFgbLz5BoTWt7eHT0tQQd+3VzY9xOfcp+g6FLtKAa26QQd7YmF58zhdpG7gqp0Ry5F9ugt3uuCQVzei6FbHCQ6rq6upPMbYaPcM+9T1F0a6TogNm0xSEc5syf3ErakS/DsO0Sfme2SLrEpbVQUTQ2lo4YWjkxgb8FlBrRwAHsVUXbIY2bLQPki5REROpEREQhEREIURprUtv1PaYa6imYXuaOth2u1E7m0jjx581LoiEIiIhCIiIQiIiEIiIhCIiIQiIiEKL1DqG36btU1fXzsZsNJjjLu1K7k1o55PlxKIiEL//2Q==",
            "iat":1660836160,
            "isPlayPass": false,
            "allowance":0
        }
}
Example of Status
import * as ApiKey from 'zoo-game-sdk/src/auth/apikey/index'
import axios from 'axios';

// Initialized API KEY and SECRET KEY
const API_KEY = 'YourApiKey';
const SEC_KEY = 'YourSecretKey';

// Signing body data with HMAC signing
let body = {jwt: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6ImNyeXB0b2Zlbm5lYyIsInByaW1hcnlBZGRyZXNzIjoiMHg2QWI0OTljOEUyZjNDQmM5Qzk5MDM0YjZlMjkxMjE0OTIxMmJFNzcwIiwibWlycm9yQWRkcmVzcyI6IjB4ZTQyNzQxZjI4ZTE1YzU4NzkxMjlGZTVGNzQ5Zjc4NjIzZWU3MTIzNiIsIm1pcnJvckJhbGFuY2UiOiI1NTUuMSIsImNoYWluSWQiOiI4ODgiLCJ2ZXJpZnkyRkFTdWNjZXNzVGltZXMiOjQsImlhdCI6MTY1NjMxMTc4MH0.4EzwI54lVs_9zx2Qy-UhDsVb5PocHIDjxK0cCIxEZko"};
let bodyMessage = JSON.stringify(body); 
let hmac = ApiKey.signData(bodyMessage, SEC_KEY); // hmac or SignedSignatureFromPayload  

// Request by Post Method //
let ret = await axios.post(`/api/${API_KEY}/session/status`, body, {headers:{Authorization: `Bearer ${hmac}`}});
console.log('ret', ret.data);

Login and Approve

When users interact with the Login and Approve API, they are required to provide their login credentials, ZooGamesID and 2FA, to authenticate themselves and gain access to their account. Upon successful authentication, users can proceed to approve in-game transactions.

If the 2FA validation fails or is not provided by the player, the transaction will not be approved and will result in a failure.

Login and Approve API - to Login and Approve at once

POST API_END_POINT_URL/API_KEY/session/loginAndApprove

SDK Preparation

You need to prepare for SignedSignatureFromPayload by

Installing zoo-game-sdk by npm install zoo-game-sdk

Import SDK by import * as ApiKey from 'zoo-game-sdk/src/auth/apikey/index'

Signing by SDK

let bodyMessage =JSON.stringify(payload);

let hmac = ApiKey.signData(bodyMessage, SEC_KEY);

*Use "hmac" as SignedSignatureFromPayload

Path Parameters

NameTypeDescription

API_KEY*

String

API KEY

Headers

NameTypeDescription

authorization*

String

Bearer SignedSignatureFromPayload

Request Body

NameTypeDescription

username*

String

ZooGamesId

token*

String

6 digits of 2FA token

approval*

Decimal

vZOO amount for approval (e.g. 0.1)

playSeconds*

Integer

approval expiry in (e.g. 3600)

gameAddress*

Address

Address of Game/Project registered Primary Address

{
    "success":true,     
    "data":"eyJhbGciOiJIUzI1Ni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MSIsInBsYXlTZWNvbmRzIjoiMzYwMCIsInN0YXJ0VGltZSI6MTY2MTc5MDAxNSwiZW5kVGltZSI6MTY2MTc5MzYxNSwiZ2FtZUFkZHJlc3MiOiIweDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAifQ.TF0AqIniXLg7rEhVOurFnM7MrTTvosXCYpVn0oorgBc"
}
Example of Login and Approve
import * as ApiKey from 'zoo-game-sdk/src/auth/apikey/index'
import axios from 'axios';

// Initialized API KEY and SECRET KEY
const API_KEY = 'YourApiKey';
const SEC_KEY = 'YourSecretKey';

// Signing body data with HMAC signing
let body = {username: "myusername", "token":"123456", "approval":0.1, "playSeconds":3600, "gameAddress": "0xd207d371d7a24F65cE9CcB3C78B58f27DF279Eb2"};
let bodyMessage = JSON.stringify(body); 
let hmac = ApiKey.signData(bodyMessage, SEC_KEY); // hmac or SignedSignatureFromPayload  

// Request by Post Method //
let ret = await axios.post(`/api/${API_KEY}/session/loginAndApprove`, body, {headers:{Authorization: `Bearer ${hmac}`}});
console.log('ret', ret.data);

Last updated