Generate eGain OAuth Tokens

To connect eGain to a Knowledge Hub knowledge base, you must either provide your eGain credentials to NiCE Professional Services or enter them in Knowledge Hub yourself. This page describes how to configure Basic and OAuth 2 authentication methods in the eGain interface. Basic authentication uses a username and password for direct access, while OAuth 2 is a token-based method that enables eGain to request and use access tokens for secure communication with Knowledge Hub.

Configuring Basic Authentication in eGain

To configure Basic authentication:

  1. In eGain, from the navigation menu, go to Integration > External Apps > Authentication.

  2. On the List page toolbar, select New.

  3. On the Properties page, under the General tab, enter the following:

    1. Name: Enter a name for the configuration.

    2. Description: Enter a brief description.

    3. Authentication type: Select Basic.

  4. On the Configuration tab, enter the following:

    1. User Name: Enter the username for the account used by the data adapter.

    2. Password: Enter the password for the account used by the data adapter.

  5. Click Save to save the configuration.

Configuring OAuth2 Authentication in eGain

Create a new authentication configuration.

  1. In eGain, from the navigation menu, go to Integration > External Apps> Authentication.

  2. On the List page toolbar, click New.

  3. On the Properties page, under the General tab, enter the following:

    1. Name: Enter a name for the configuration.

    2. Description: Enter a brief description.

    3. Authentication type: Select OAuth2.

  4. On the Configuration tab, enter the following:

    Field name

    description

    OAuth2 ClientId Enter the unique string representing the registration information provided by the service provider.
    OAuth2 ClientSecret Enter the secret string provided by the service provider to authorize the client requesting an access token.

    Refresh Token

    Enter the credential used to obtain new access tokens when the current token expires.
    Token Request URL Enter the URL used to request the access token. This field is required.
    Method

    Select POST or GET based on what the client authentication server supports.

    If GET is selected, the Content-Type and Token Request Body fields are disabled.

    Content-Type

    Select the format of the request content. Options include:

    • application/json

    • application/xml

    • application/x-www-form-urlencoded

    Token Request Body

    Provide the parameters for the token request body. Format the string as:

    client_id=<client_id>&client_secret=

    <client_secret>&refresh_token=

    <refresh_token>&grant_type=refresh_token

    Access Token JSON Path Enter the JSON path to extract the access token from the response. For example: $.access_token
    Access Token (Optional) Enter a current access token if available. Leave blank to allow the application to request a new token using the provided details.
    Headers Add any additional headers excluding the content-type by entering a Name and Value, then selecting Add. These headers will be included in the token request.
  5. Click Save.

Login to CXone Mpower Using eGain Authentication

eGain is configured with a mock API in CXone Mpower because valid client credentials are not available.

  1. In the Knowledge Hub section, go to Source Configurations.

  2. From the Knowledge Source drop-down, select eGain.

  3. Set the Authentication Type to either BASIC or OAUTH2.

  4. Based on the selected authentication type, enter the required details:

    1. If you selected BASIC:

      • Username

      • Password

      • Portal ID

    2. If you selected OAUTH2:

      • Portal ID

      • Client ID

      • Client Secret

      • Access Token

      • Auth Code

      • Refresh Token

  5. Set the Sync Frequency to Every Day.

  6. Click Save to apply the configuration.