Scenario 3: Login Using an App ID
Description
If you have applied for an app ID, you can use the app ID to log in to Huawei Cloud Meeting, without entering an account and password.
![](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 an API.
- Create an AppIdAuthParam object.
- Set the unique ID of a third-party account.
- Set a random character string.
- Set signature information.
- ID of the enterprise to which the user belongs. This parameter is mandatory only in SP mode.
- Set the password expiration time.
- Set the nickname of the login account.
- Set the email address of the login account.
- Set the mobile number of the login account.
- Call the loginByAppid API to log in. The data in the preceding step is used as input parameters. The meeting server registers the user accordingly.
- Create an AppIdAuthParam 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 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
// Create a login object. AppIdAuthParam appIdAuthParam = new AppIdAuthParam(); // Set the signature expiration time. The value is a Unix timestamp, in seconds. If the value is 0, the signature will not expire. appIdAuthParam.setExpireTime(1599618620); // Set a random character string consisting of 32 to 64 characters. appIdAuthParam.setNonce("hYLOWv69MIikVussTOucZOyWEMM1reDi"); // Set the ID of the enterprise to which the user belongs. This parameter is required only in the SP login scenario. appIdAuthParam.setCorpId(123); // Set the ID of the third-party account. The value is a string of 1 to 64 characters. appIdAuthParam.setUserId("huawei123456"); // Set signature information. appIdAuthParam.setSignature("198c3046dbdafa9d89ce917c5613c29fda855da2aa79f8f51f2871e88fdba91c"); // Set the user nickname. appIdAuthParam.setUserName("huawei123455"); // Set the email address, which must meet the format requirements. appIdAuthParam.setUserEmail("huawei123456@huawei.com"); // Set the mobile number, which must be in the correct format, for example, ^$|^[+]?[0-9]+$. appIdAuthParam.setUserPhone("15900000000"); // Start to log in. HWMSdk.getOpenApi(getActivity().getApplication()).loginByAppId(appIdAuthParam, new HwmCallback<LoginResult>() { @Override public void onSuccess(LoginResult loginResult) { dismissLoading(); dismiss(); if (loginResult != null) { DemoUtil.showToast("Login succeeded" + loginResult.getUserUuid()); }else{ DemoUtil.showToast("Logged in"); } } @Override public void onFailed(int retCode, String desc) { HwmContext.getInstance().runOnMainThread(() ->{ dismissLoading(); Error error = HWMBizSdk.getLoginApi().convertErrorCodeToUI(retCode); DemoUtil.showToast("Login failed: "+ getLoginErrTips(error)); dismiss(); }); } }); |
Precautions
The loginByAppid 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