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

SSO Login

1
HWMSdk.getOpenApi.loginBySSO(SsoAuthParam ssoAuthParam, HwmCallback<LoginResult> callback)

API Description

This API is used for login in single sign-on (SSO) mode.

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
7
8
    /**
     * SSO login API
     * @param code Indicates the authorization code.
     * @param domain Indicates the enterprise domain name.
     * @param authServerType Indicates the authentication server type.
     * @param callback
     */
    void loginBySSO(SsoAuthParam ssoAuthParam, HwmCallback<LoginResult> callback);

Parameter Description

Table 1 Parameter description

Parameter

Mandatory

Type

Description

ssoAuthParam

Yes

SsoAuthParam

SSO login authentication parameters.

callback

Yes

HwmCallback<LoginResult>

Callback object.

Table 2 SsoAuthParam parameter description

Parameter

Mandatory

Type

Description

code

Yes

String

SSO authorization code.

domain

Yes

String

SSO enterprise domain name.

authServerType

Yes

AuthServerType

Authentication server type. Value:

AUTH_SERVER_TYPE_OAUTH2 (0, "SSO")

Return Values

None

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
SsoAuthParam ssoAuthParam = new SsoAuthParam();
        ssoAuthParam.setDomain(domain);
        ssoAuthParam.setCode(code);
        ssoAuthParam.setAuthServerType(AuthServerType.AUTH_SERVER_TYPE_OAUTH2);
HWMSdk.getOpenApi(ssoAuthParam, new HwmCallback<LoginResult>() {
            @Override
            public void onSuccess(LoginResult loginResult) {
                dismissLoading();
                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(() -> {
                    DemoUtil.showToast("Login error: code=" +  retCode + " desc=" + desc);
                    dismissLoading();
                });
            }
        });