更新时间:2024-06-28 GMT+08:00
分享

场景2:登录

描述

可用App ID(App ID申请请参考“App ID鉴权介绍”)或华为云会议账号登录华为云会议。创建会议等接口不支持在未登录状态下调用,若要使用完整的会议功能,必须先登录华为云会议。

在未登录状态下,只能加入已经创建的会议。

业务流程

使用SDK登录时,以App ID登录方式为例,调用loginByAppId接口,同时设置接口回调onLoginResult。

  1. 接口调用

    1. 组装数据结构AppIdAuthInfo和接口回调函数onLoginResult。
    2. 调用loginByAppId进行登录,第1步中的数据作为参数。

  2. 处理回调函数

    处理回调函数onLoginResult。

示例代码

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
/**
* 登录处理
*/
async goToLoginByAppId(){
   /**
    *.此处省略第三方服务器做的数据转换,最后获取到nonce和signature
    */
    let param = {
      thirdUserId: getThirdUserId(),
      userName: getUserName(),
      signature: getSignature(),
      nonce: getNonce(),
      expireTime: 1598398920,
      userEmail: getEmail(),
      userPhone: getUserPhone(),
    }
    const apiService = new ApiService();
    let setResult = await apiService.loginByAppId(param);
    if(setResult.ret == 0){
      this.props.history.push('/main');
    }else{
      window.electron.ipcRenderer.send("show-error-alert", "loginByAppId error = " + setResult.ret);
    }
  }

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
/**
* ApiService中loginByAppId接口定义
*/
async loginByAppId(appIdAuthInfo) {
    return new Promise((resolve) => {
      let resultCallback = (ret, reason, loginResult) => {
        console.log("loginByAppId, out data = ", { ret, reason, loginResult });
        resolve({ ret, reason, loginResult });
      };
      console.log("loginByAppId, in param = ", appIdAuthInfo);
      this.uisdkService.getLoginApi().loginByAppId(appIdAuthInfo, resultCallback);
    });
}
分享:

    相关文档

    相关产品