保利威文档中心

帮助中心

Interface: AuthSetting

更新时间:2025-10-10 12:02:04

Polyv Wx Live Core SDK


Polyv Wx Live Core SDK / AuthSetting

Interface: AuthSetting

鉴权配置

Properties

appId

appId: string

应用ID


sign

sign: string

校验签名

Example

签名计算示例,注意:请勿在前端代码出现明文appSecret,建议通过后端接口获取appSecret

const params = {
  appId: appId,
  channelId: channelId,
  timestamp: new Date().getTime(),
}
const apiSecret = '123456';

function getSign(obj: any, apiSecret: string) {
  const resortParam = (obj: any) => {
    const arr = Object.keys(obj)
      .filter(item => item !== 'sign')
      .sort(); // 拿到除sign外字母顺序排列的key
    let query = '';
    arr.forEach(item => {
      query += `${item}${obj[item]}`;
    });
    return query;
  };
  const query = resortParam(obj);
  return md5(`${apiSecret}${query}${apiSecret}`).toUpperCase();
}
const sign = getSign(params, apiSecret);

timestamp

timestamp: number

校验时间戳

联系客服,在线咨询