Updated on 2024-07-30 GMT+08:00

Login

Login

API Description

This API is used to log in to Huawei Cloud Meeting. You can log in to the system using a Huawei Cloud Meeting account or an app ID, which is determined by the authType parameter.

Precautions

  1. You must log in to Huawei Cloud Meeting before using functions such as creating meetings and being invited into meetings. If you do not log in, you cannot experience complete meeting functions.
  2. This API is an asynchronous API. The return value only indicates whether the API is successfully called. The actual service processing result is returned in the corresponding callback function.

Method Definition

1
HWM_SDK_AGENT_API hwmsdk::HwmErrCode Login(HwmLoginInfo *loginInfo);

Callback Function

1
virtual void OnLoginResult(hwmsdk::HwmErrCode ret, const char* reason, const HwmLoginResult* loginResult) {};

Parameter Description

Table 1 HwmLoginInfo description

Parameter

Mandatory

Type

Description

authType

Yes

HwmAuthType

Login type. For details, see Table 2.

accountAndPasswordAuthInfo

No

HwmAccountAndPasswordAuthInfo

Account and password login details. Required when account and password authentication is selected.

appIdAuthInfo

No

HwmAppIdAuthInfo

App ID login details. Required when app ID authentication is selected.

Table 2 HwmAccountAndPasswordAuthInfo description

Parameter

Mandatory

Type

Description

account

Yes

char[]

Login account.

password

Yes

char[]

Login password.

Table 3 HwmAppIdAuthInfo description

Parameter

Mandatory

Type

Description

thirdUserId

Yes

char[]

Third-party user ID.

corpId

No

char[]

ID of the enterprise to which the user belongs. This parameter is mandatory only in SP mode. Do not set this parameter in single-enterprise mode. Otherwise, the authentication will fail.

userName

No

char[]

Username. If this parameter is left blank, the value of this parameter is the same as that of thirdUserId by default.

signature

Yes

char[]

Authentication signature obtained from the third-party server.

nonce

Yes

char[]

Nonce value obtained from the third-party server, which is used by the Huawei Cloud server to verify the validity of the authentication signature.

expireTime

Yes

long long

Timestamp of the validity period of the authentication signature obtained from the third-party server. The value 0 indicates that authentication signature never expires.

email

No

char[]

Email address of the user.

phoneNumber

No

char[]

Mobile number of the user.

deptCode

No

char[]

Department ID.

Return Values

Table 4 Return values

Type

Description

HwmErrCode

If 0 is returned, the operation is successful. If other values are returned, the operation fails. For details about values returned upon failures, see Common Error Codes.

HwmLoginResult

Login result.

Table 5 HwmLoginResult description

Parameter

Type

Description

userUuid

char[]

UUID, which is the unique user ID allocated by the system.

account

char[]

Account.

thirdAccount

char[]

Third-party account.

Sample Code

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/**
* Login
*/
int demoLoginDlg::Login()
{
    int ret;
    // Set app ID login parameters.
   /**
    *. The data conversion performed by the third-party server is omitted here. The nonce and signature are obtained.
    */
    strncpy_s(loginParam.appIdAuthInfo.thirdUserId, GetUserId().c_str(), HWM_MAX_USER_ID_LEN);
    strncpy_s(loginParam.appIdAuthInfo.userName, GetUserName().c_str(), HWM_MAX_USER_NAME_LEN);
    strncpy_s(loginParam.appIdAuthInfo.signature, GetSignature().c_str(), HWM_MAX_SIGNATURE_LEN);
    strncpy_s(loginParam.appIdAuthInfo.nonce, GetNonce().c_str(), HWM_APPID_NONCE_LEN );
    strncpy_s(loginParam.appIdAuthInfo.email, GetEmail().c_str(), HWM_MAX_EMAIL_LEN);
    strncpy_s(loginParam.appIdAuthInfo.phoneNumber, GetPhoneNumber().c_str(), HWM_MAX_PHONE_NUM_LEN);
    loginParam.appIdAuthInfo.expireTime = 1598398920; // UTC time, in seconds

    loginParam.authType = hwmsdkagent::HWM_AUTH_TYPE_APPID;
    // Call the login API.
    ret = hwmsdkagent::Login(&loginParam);
    return ret;
}