Authenticating user within the conversation using OAuth v2

You can authenticate a user within the conversation by getting user data (through API call) after the Sign in action is performed.

Step 1. Define the Get user identity action

To create the Get user identity action, follow these steps:

  1. Go to the OAuth2 app configuration page, click the add icon () next to the Get User Identity Connector Action field. The Connector Action page appears on the ConnectorGeneral tab.
  2. Provide a Name, Description and Category and select Is Active.
  3. Click Save. The page refreshes and displays on the ConnectorSteps tab.
  4. At the top-right corner of the page, click the Create Task button and select GetUserIdentity.
  5. Note:  This special connector action ONLY uses the system [[ChatUser]] DRUID Entity for capturing the response data. No other (custom) entity can be used, as [[ChatUser]] is further required in the conversational authentication process (SaveIdentifiedUser, etc.).

    The Edit Connector Action page appears on the General tab.

Step 2. Define the GetUserIdentity integration task

Enter a Description and from the Connection Code drop-down, select the OAuth2 app.

Click the Request tab and provide the API endpoint for getting user metadata (the API endpoint of the target application).

Example: Get user data from Google API

Other request settings are available and you can further configure the request based on what the web API service is expecting. For more information, see REST Requests.

Click the Response tab and map user metadata (email, first name, last name, other) returned by the API service to DRUID [[ChatUser]] fields.

Example: Get user’s email from Google API

 

You can test the Sign in action. Click the Test tab and click the Test button. Confirm the authorization in the API hosted page that opens. The Test result, either success or failure, and the response details are displayed in the Test result section.

Click Save & Close twice to go to the Integrations page. Publish the integration by clicking the Publish button () at the top-right corner of the page.

Step 3. Select Get User Identity action on the OAuth2 app

Go to the OAuth2 app configuration page and from the Get User Identity Connector Action field, select the integration you defined at Step 2.

Save the app.

Step 4. Design the flow for signing in users with OAuth v2

Go to the conversational flow designed for OAuth v2 authorization. Click on the Oauth 2.0 Sign in step and tap on Get user identity.

Save the step.

When the Oauth 2.0 Sign in step is executed, the user’s identity metadata will be available in [[ChatUser]] entity, according to the response mapping in the “Get User Identity Connector Action”. Further on, authors need to perform the DRUID specific conversational authentication process (SaveIdentifiedUser, SaveAuthenticatedUser, etc.) on the following step, or even in the PostActions section of the SSO Sign In step.

Important!  The SSO Sign In step DOES NOT automatically authenticate the user in the conversation!