Initializing the Client

The methods for initializing NLP SDK clients are the same. Construct the AuthInfo class and select an authentication method. There are two ways of authentication: AK/SK-based authentication and username and password-based authentication during initialization.

AK/SK-based Authentication

//
//Obtain the AK/SK, region, and project ID by referring to sections "Authentication", "Obtaining SDKs", and "Obtaining a Project ID".
//For example, if the AK is {ak}, the SK is {sk}, the region is {region}, the project ID is {projectId}, the client is constructed as follows:
//
AuthInfo authInfo = new AuthInfo("{ak}","{sk}","{region}","{projectId}");

//
//After AuthInfo is constructed, initialize the corresponding client. In this case, set the first parameter of the construction method to AuthMode.AKSK.
//
NlpfClient client = new NlpfClient(AuthMode.AKSK,authInfo);

Username and Password-based Authentication

//
//Obtain the region and project ID by referring to sections "Obtaining SDKs" and "Obtaining a Project ID".
//For example, if the username is {userName}, the password is {pwd}, the account is {domainName}, the region is {region}, the project ID is {projectId}, the client is constructed as follows:
//An account can have two or more users. If a user uses the account for login, the value of userName should be the same as that of domainName.
//
AuthInfo authInfo = new AuthInfo("{userName}","{pwd}","{domainName}","{region}","{projectId}");

//
//After AuthInfo is constructed, initialize the corresponding client. In this case, set the first parameter of the construction method to AuthMode.TOKEN.
//
NlpfClient client = new NlpfClient(AuthMode.TOKEN,authInfo);