Token Authentication Guide
Before calling the TaurusX Open API, you need to obtain the following two keys from your Account Manager (AM). Please keep them safe and do not disclose them:
Access Key
: used for identity recognitionSecret Key
: used as encryption credential to generate the Token
After obtaining the keys, you can generate the Token
parameter according to the rules below. All Open API requests must include this Token in the request headers for authentication.
Token Parameter Generation Rules
The Token parameter generation rules are as follows:
Field | Type | Description | Example Value |
---|---|---|---|
access-key | string | The Access Key assigned to you | 018168163a17d44907669d58ee9ad687 |
timestamp | int | Current timestamp (in seconds) | 1697785289 |
token | string | Generation method: MD5(secret_key.MD5(timestamp)) | a6864d4ef31b09cdc1c5d22214cde5db |
Request Header Example
Assuming that the requested URL is https://scaler.taurusx.com/openapi/performance_data
, then the request header needs to be added
txt
access-key: 018168163a17d44907669d58ee9ad687
token: a6864d4ef31b09cdc1c5d22214cde5db
timestamp: 1697785289
access-key: 018168163a17d44907669d58ee9ad687
token: a6864d4ef31b09cdc1c5d22214cde5db
timestamp: 1697785289
Example
Python Example
Python
import time
import hashlib
secret_key = "af6d4b1cbdb4fbe2d1ee838fabfe92fe"
timestamp = str(int(time.time()))
token = hashlib.md5((secret_key + hashlib.md5(timestamp.encode()).hexdigest()).encode()).hexdigest()
print(token)
import time
import hashlib
secret_key = "af6d4b1cbdb4fbe2d1ee838fabfe92fe"
timestamp = str(int(time.time()))
token = hashlib.md5((secret_key + hashlib.md5(timestamp.encode()).hexdigest()).encode()).hexdigest()
print(token)
Go Example
Go
package main
import (
"crypto/md5"
"encoding/hex"
"fmt"
"time"
)
func md5Hash(s string) string {
hash := md5.Sum([]byte(s))
return hex.EncodeToString(hash[:])
}
func main() {
secretKey := "af6d4b1cbdb4fbe2d1ee838fabfe92fe"
timestamp := fmt.Sprintf("%d", time.Now().Unix())
token := md5Hash(secretKey + md5Hash(timestamp))
fmt.Println(token)
}
package main
import (
"crypto/md5"
"encoding/hex"
"fmt"
"time"
)
func md5Hash(s string) string {
hash := md5.Sum([]byte(s))
return hex.EncodeToString(hash[:])
}
func main() {
secretKey := "af6d4b1cbdb4fbe2d1ee838fabfe92fe"
timestamp := fmt.Sprintf("%d", time.Now().Unix())
token := md5Hash(secretKey + md5Hash(timestamp))
fmt.Println(token)
}
PHP Example
PHP
<?php
$secret_key = 'af6d4b1cbdb4fbe2d1ee838fabfe92fe';
$timestamp = time();
$token = md5($secret_key.md5($timestamp));
?>
<?php
$secret_key = 'af6d4b1cbdb4fbe2d1ee838fabfe92fe';
$timestamp = time();
$token = md5($secret_key.md5($timestamp));
?>
Notes
Please ensure that the timestamp
represents the current time (in seconds) when the request is made.
If the server time differs significantly from the actual time, the authentication may fail.