Updated on 2023-03-23 GMT+08:00

Login Using an Account and Password

1
HWMSdk.getOpenApi.login(LoginParam,HwmCallback)

API Description

This API is used to log in to Huawei Cloud Meeting.

Precautions

You can join a meeting anonymously. However, if you want to use other services, you must log in first.

After the login is successful, the callback onSuccess is invoked.

Method Definition

1
2
3
4
5
6
    /**
     * Logs in.
     * @param LoginParam Indicates the LoginParam object.
     * @param hwmCallback Indicates the result callback.
     */
void login(LoginParam loginParam HwmCallback<LoginResult> hwmCallback)

Parameter Description

Table 1 Parameter description

Parameter

Mandatory

Type

Description

loginParam

Yes

LoginParam

LoginParam object.

hwmCallback

Yes

HwmCallback<LoginResult>

Callback object.

Return Values

None

Parameter Extension

Table 2 LoginParam parameters

Parameter

Mandatory

Type

Description

account

Yes

String

Username.

password

Yes

String

Password.

huaweiAccountAccessToken

No

String

Access token of the HUAWEI ID.

nickName

No

String

Display name.

Table 3 LoginResult type description

Parameter

Type

Description

userUuid

String

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

account

String

Login account.

thirdAccount

String

Third-party login account (in the app ID login scenario).

isFreeUser

boolean

Whether the user is a free user.

refreshToken

String

Refresh token.

siteDomain

String

Login domain name. This parameter is available only in site switchover scenarios. When a user selects the International site but uses a Chinese mainland account to log in, the system automatically switches to the Chinese mainland site and returns the domain name of the Chinese mainland.

Sample Code

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
LoginParam loginParam = new LoginParam()        
    .setLoginAuthType(LoginAuthType.Account_And_Password)       // Set the login mode.
    .setAccount("139571854984")        // Set the login account.
    .setPassword("Change_Me");      // Set the login password.
     
HWMSdk.getOpenApi(getActivity()).login(loginParam, new HwmCallback<LoginResult>() {             
     @Override             
     public void onSuccess(LoginResult loginResult) {  // Callback invoked upon a successful login.
         if (loginResult != null ) {                     
             Log.i(TAG, "Login succeeded" + loginResult.getUserUuid());
         }
     }              
     @Override             
     public void onFailed(int retCode, String desc) {   // Callback invoked upon a login failure.
        Error error = HWMBizSdk.getLoginApi().convertErrorCodeToUI(retCode);                 
        String errorTip = getLoginErrTips(error);               // Output the error cause based on the returned error value.
        Log.e(TAG, errorTip);     
     }        
});