This section contains the API reference for Validate Session Token API and the sample code segments to validate the token.
This API is used to validate the session token.
The following are the details associated with the Validate Token API:
https://cloud.bluestacks.com
/app_player/validate_session_token
POST
token: <unique_token_with_5_min_expiry> // Passed to the game on-demand package_name: <Your_app_package_name> // Replace with your game package name secret_api_key: <Your_secret_api_key> // Required for API Authentication
Note: You can get the secret_api_key
(Shield API Key) by following the steps mentioned here.
{ is_verified: <True/False>, error_code : <error_code> // Error code if is_verified is False }
The following are the possible error codes you may receive as a response to the API call.
Error Codes | Definition |
1001 | Secret API key is not correct |
1002 | Token already verified |
1003 | Token expired |
1004 | The token does not have enough segments |
1005 | Any general error in our backend |
-100 | HTTP connection error |
-101 | HTTPS response read error |
-102 | JSON parsing error |
-103 | Internal BlueStacks error |
0 | Success |
For your reference, we have provided sample code segments to validate the token:
curl --location --request POST "https://cloud.bluestacks.com/app_player/validate_session_token" \ --form "token=<your_token_here>" \ --form "secret_api_key=<your_secret_api_key_here>" \ --form "app_package=<your_app_package_name_here>"
OkHttpClient client = new OkHttpClient().newBuilder() .build(); MediaType mediaType = MediaType.parse("text/plain"); RequestBody body = new MultipartBody.Builder().setType(MultipartBody.FORM) .addFormDataPart("token","<your_token_here>") .addFormDataPart("secret_api_key","<your_secret_api_key_here>") .addFormDataPart("app_package","<your_app_package_name_here>") .build(); Request request = new Request.Builder() .url("https://cloud.bluestacks.com/app_player/validate_session_token") .method("POST", body) .build(); Response response = client.newCall(request).execute();
import requests url = "https://cloud.bluestacks.com/app_player/validate_session_token" payload={'token': '<your_token_here>', 'secret_api_key': '<your_secret_api_key_here>', 'app_package': '<your_app_package_name_here>'} response = requests.request("POST", url, data=payload) print(response.text)
var axios = require('axios'); var FormData = require('form-data'); var data = new FormData(); data.append('token', '<your_token_here>'); data.append('secret_api_key', '<your_secret_api_key_here>'); data.append('app_package', '<your_app_package_name_here>'); var config = { method: 'post', url: 'https://cloud.bluestacks.com/app_player/validate_session_token', data : data }; axios(config) .then(function (response) { console.log(JSON.stringify(response.data)); }) .catch(function (error) { console.log(error); });
<?php require_once 'HTTP/Request2.php'; $request = new HTTP_Request2(); $request->setUrl('https://cloud.bluestacks.com/app_player/validate_session_token'); $request->setMethod(HTTP_Request2::METHOD_POST); $request->setConfig(array( 'follow_redirects' => TRUE )); $request->addPostParameter(array( 'token' => '<your_token_here>', 'secret_api_key' => '<your_secret_api_key_here>', 'app_package' => '<your_app_package_name_here>' )); try { $response = $request->send(); if ($response->getStatus() == 200) { echo $response->getBody(); } else { echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' . $response->getReasonPhrase(); } } catch(HTTP_Request2_Exception $e) { echo 'Error: ' . $e->getMessage(); }
Contact us at dev-support@now.gg, and we will be happy to assist you.
문서 Rev. 1.0