DeveloperDeveloper
  • Standard Solutions
  • Cam Solutions
  • Native SDKs
  • App Gallery
  • Game Engine Plugins
Forum
Projects Library
Dev Discord
  • Standard Solutions
  • Cam Solutions
  • Native SDKs
  • App Gallery
  • Game Engine Plugins
Forum
Projects Library
Dev Discord
  • Get UID and Token

Get UID and Token

API

Get a unique Lovense UID and token for use with Lovense Pattern Editor initialization

API URL: https://api.lovense-api.com/api/server/peditor/v1/uid?user={user-id}&pkey={secret-key}&platform={platform}

Request Protocol: HTTPS Request

Method: GET

Request Content Type: application/json

Parameters:

ParametersDescriptionTypeRequired
secret-keyA secret key generated by Lovense. Please contact us to obtain the key. Never reveal the secret-key on the client side.stringYes
user-idYour user's ID from your platform. Up to 1000 characters.stringYes
platformContact us to confirm thisstringYes

Response Format: JSON

Response:

nametypedescription
uidstringFor video patterns initialization.
tokenstringFor video pattern initialization. Valid time is 24 hours, if a new token is generated with the same user-id and platform, the old token will be invalidated.

Request Example:

Sample response:

{
  "uid": "fx1adxzxcasdq2", // uid
  "token": "token" // video pattern token
}

⚠️ For security reasons, to avoid secret-key exposure we recommend to perform such requests from server side only, not from the client side.

Example

// <dependency>
//     <groupId>org.apache.httpcomponents</groupId>
//     <artifactId>httpclient</artifactId>
//     <version>4.5.10</version>
// </dependency>

import org.apache.http.HttpEntity;
import org.apache.http.HttpHeaders;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;

import java.io.IOException;

public class HttpClientExample1_1 {

    public static void main(String[] args) throws IOException {

        CloseableHttpClient httpClient = HttpClients.createDefault();

        try {

            HttpGet request = new HttpGet("https://api.lovense-api.com/api/server/peditor/v1/uid?user=[user-id]&pkey=[secret-key]&platform=[Website Name]");

            CloseableHttpResponse response = httpClient.execute(request);

            try {
                System.out.println(response.getStatusLine().getStatusCode());   // 200
                HttpEntity entity = response.getEntity();
                if (entity != null) {
                    // return it as  String
                    String result = EntityUtils.toString(entity);
                    System.out.println(result);// result
                }

            } finally {
                response.close();
            }
        } finally {
            httpClient.close();
        }

    }

}

Last Updated:
Explore our Forum or Support to get more inspiration or solve your problems.
Discord Channel
It is an online real-time channel where you can communicate directly with our official administrators or many excellent developers.
Forum
It is a place for Lovense developers to communicate, where you can find solutions to problems or get inspired for your projects.
Support
Find documents and tutorials that may be helpful to you.