保利威文档中心

幫助中心

介面: AuthSetting

更新時間:2025-10-10 12:02:04

Polyv Wx Live Player Component


Polyv Wx Live Player Component / modules/plv-live-player-core/polyv-live-player / AuthSetting

介面: AuthSetting

鑑權配置

屬性

appId

appId: string

應用程式ID


sign

sign: string

校驗簽名

範例

簽名計算範例,注意:請勿在前端程式碼出現明文appSecret,建議透過後端介面取得appSecret

const params = {
 appId: appId,
 channelId: channelId,
 timestamp: new Date().getTime(),
}
const appSecret = 'xxx';
const sign = getSign(params, appSecret);
/**
 * 鉴权sign计算
 */
getSign(params: any, appSecret: string) {
  const resortParam = (params: any) => {
    const arr = Object.keys(params)
      .filter(item => item !== 'sign')
      .sort(); // 拿到除sign外字母顺序排列的key
    let query = '';
    arr.forEach(item => {
      query += `${item}${params[item]}`;
    });
    return query;
  };
  const query = resortParam(params);
  return md5(`${appSecret}${query}${appSecret}`).toUpperCase();
}

timestamp

timestamp: number

校驗時間戳記

联系客服,在线咨询