Scenario 2: Login Using an Account and Password
Description
Before using HUAWEI CLOUD Meeting, you must complete login authentication on the server.
![](https://support.huaweicloud.com/intl/en-us/sdkreference-meeting/public_sys-resources/note_3.0-en-us.png)
If you have not logged in, you can only join created meetings.
Service Process
- Call the API.
- Create a LoginParam object.
- Select a proper login type.
- Set the account and password.
- Call the login API to log in. The data in the preceding step is used as input parameters.
- Create a LoginParam object.
- Implement the callback.
Process the result in the callback.
Sample Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
// Create a login object. LoginParam loginParam = new LoginParam() .setLoginAuthType(LoginAuthType.Account_And_Password) .setAccount("huawei") // Set the login account. .setPassword("123456"); // Set the login password. // Start to log in. HWMSdk.getOpenApi(getApplication()).login(loginParam, new HwmCallback<LoginResult>() { @Override public void onSuccess(LoginResult loginResult) { Log.i(TAG, "Login succeeded"); } @Override public void onFailed(final int retCode, String desc) { HwmContext.getInstance().runOnMainThread(new Runnable() { @Override public void run() { Error error = HWMBizSdk.getLoginApi().convertErrorCodeToUI(retCode); Log.i(TAG, "Login failed: "+ error.getMessage()); } }); } }); |
Precautions
The login API can be called only after HWMSdk.init is successfully called.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot