Access Auth List


Integration management is used to authorize third-party systems to access the LarkXR platform, in order to prevent unauthorized third parties from integrating with LarkXR without permission.

invalid image (图片无法加载)

adminKey and adminSecret are used for secure API calls

Some interfaces (such as uploading applications, modifying applications, etc.) require secure calls. The credentials will expire after 15 minutes, at which point the interfaces will become inaccessible. To ensure the security of API calls, it is necessary to recalculate the signature parameters to generate a new interface address.

Steps to generate a signature:

  1. Sort adminKey, adminSecret, and the current timestamp (long integer) alphabetically, then generate a SHA-1 digest signature. Example code will be provided at the end of the document.

  2. Name the timestamp and signature as timestamp and signature respectively.

  3. Include adminKey, timestamp, and signature parameters in the interface parameters. Please refer to the development version interface document for specific usage rules.

Please refer to the example code below to generate the signature.

java
java代码示例
public static String getSignature( String key, String secret, String timestamp){
String[] arr = new String[] { key, secret, timestamp };
        // appKey、appSecret、timestamp三个参数进行字典序排序
        Arrays.sort(arr);
        StringBuilder sb = new StringBuilder();
        //将三个参数字符串拼接成一个字符串
        for (int i = 0; i < arr.length; i++) {
            sb.append(arr[i]);
        }
        MessageDigest md;
        String signature = null;
        try {
            md = MessageDigest.getInstance("SHA-1");
            // 进行sha1摘要
            byte[] digest = md.digest(sb.toString().getBytes());
            signature = byteToStr(digest);
        } catch (NoSuchAlgorithmException e) {
            e.printStackTrace();
        }
        return signature;
}
    /**
     * 将字节数组转换为十六进制字符串
     *
     * @param byteArray
     * @return
     */
    private static String byteToStr(byte[] byteArray) {
        String strDigest = "";
        for (int i = 0; i < byteArray.length; i++) {
            strDigest += byteToHexStr(byteArray[i]);
        }
        return strDigest;
    }
    /**
     * 将字节转换为十六进制字符串
     *
     * @param mByte
     * @return
     */
    private static String byteToHexStr(byte mByte) {
        char[] Digit = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };
        char[] tempArr = new char[2];
        tempArr[0] = Digit[(mByte >>> 4) & 0X0F];
        tempArr[1] = Digit[mByte & 0X0F];
        String s = new String(tempArr);
        return s;
    }
php
PHP代码示例
// 排序
sort($arr, SORT_NATURAL);
$string = implode('', $arr);
$signature = sha1($string);

admin 2025年4月16日 14:59 收藏文档