API Reference
Search…
Generate a token
post
https://api.complycube.com
/v1/tokens
Generate a token

The referrer attribute

The referrer attribute specifies the URI of the web page where you will use the Web SDK. The referrer sent by the browser must match the referrer URI pattern in the JWT for the SDK to authenticate successfully.
The referrer is based on the Google Chrome match pattern URIs. URIs can contain wild card characters.
The referrer pattern included in the JWT guarantees that other malicious websites cannot reuse the JWT if it is lost.

Example request

cURL
Node.js
Python
PHP
.NET
1
curl -X POST https://api.complycube.com/v1/tokens \
2
-H 'Authorization: <YOUR_API_KEY>' \
3
-H 'Content-Type: application/json' \
4
-d '{
5
"clientId":"CLIENT_ID",
6
"referrer": "https://www.example.com/*"
7
}'
Copied!
1
const { ComplyCube } = require("@complycube/api");
2
3
const complycube = new ComplyCube({ apiKey: "<YOUR_API_KEY>" });
4
5
const token = await complycube.token.generate("CLIENT_ID", {
6
referrer: "https://www.example.com/*"
7
});
Copied!
1
from complycube import ComplyCubeClient
2
3
cc_api = ComplyCubeClient(api_key='<YOUR_API_KEY>')
4
5
token = cc_api.tokens.create('CLIENT_ID','https://www.example.com/*')
Copied!
1
use ComplyCube\ComplyCubeClient;
2
3
$ccapi = new ComplyCubeClient('<YOUR_API_KEY>');
4
5
$token = $ccapi->tokens()->generate('CLIENT_ID', 'https://www.example.com/*');
Copied!
1
using ComplyCube.Net;
2
using ComplyCube.Net.Resources.SDKTokens;
3
4
var sdkTokenApi = new SDKTokenApi(new ComplyCubeClient("<YOUR_API_KEY>"));
5
6
var sdkTokenRequest = { clientId = "CLIENT_ID" ,
7
referrer = "https://www.example.com/*" }
8
9
var sdkToken = await sdkTokenApi.GenerateToken(sdkTokenRequest);
Copied!