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

SSO

LoginBySSO

API Description

This API is used for single sign-on (SSO). You need to obtain the authentication code through the GetSSOAuthorizeUrl API. GetSSOAuthorizeUrl obtains the authentication website by transferring the domain name. A user enters the account and password on the website or scans the QR code for authentication to obtain a temporary code (used for login).

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 LoginBySSO(HwmSSOAuthInfo *ssoAuthInfo);

Callback Function

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

Parameter Description

Table 1 HwmSSOAuthInfo parameters

Parameter

Mandatory

Type

Description

code

Yes

char[]

Authorization code

domain

Yes

char[]

Enterprise domain name

authServerType

Yes

AuthServerType

Authentication service type

Table 2 AuthServerType parameters

Parameter

Description

AUTH_SERVER_TYPE_OAUTH2

SSO

Return Values

Table 3 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. For details, see Table 5.

Sample Code

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
/**
* Login
*/
int demoLoginBySSODlg::LoginBySSO()
{
    int ret;
    //Enter login parameters.
    string domain= "admin@1";
    string code= "XXXXXXXXXXXXXXXXXXXXXX";
    hwmsdkagent::HwmSSOAuthInfo ssoAuthInfo{};
    strncpy_s(ssoAuthInfo.domain, domain.c_str(), HWM_MAX_SSO_DOMAIN_LEN);
    strncpy_s(ssoAuthInfo.code, code.c_str(), HWM_MAX_SSO_CODE_LEN);
    ssoAuthInfo.authServerType = hwmsdkagent::AUTH_SERVER_TYPE_OAUTH2;

    // Call the login API.
    ret = hwmsdkagent::LoginBySSO(&ssoAuthInfo);
    return ret;
}