{"id":45771,"date":"2022-09-28T06:53:36","date_gmt":"2022-09-28T05:53:36","guid":{"rendered":"https:\/\/developer.kore.ai\/v10-1\/?p=45771"},"modified":"2022-09-28T06:53:37","modified_gmt":"2022-09-28T05:53:37","slug":"alert-task-oauth-v2-client-credentials","status":"publish","type":"post","link":"https:\/\/developer.kore.ai\/v10-1\/uncategorised\/alert-task-oauth-v2-client-credentials\/","title":{"rendered":"Alert Task \u2013 OAuth v2 Client Credentials"},"content":{"rendered":"<p><span style=\"font-weight: 400\">We have seen how an Alert Task can be set up in the Kore.ai XO Platform <\/span><a href=\"https:\/\/developer.kore.ai\/v10-1\/docs\/bots\/bot-builder-tool\/alert\/notification-tasks\/\"><span style=\"font-weight: 400\">here<\/span><\/a><span style=\"font-weight: 400\">. In this article, we will see how authorization for alert tasks can be set up using the OAuth v2 with client credentials.<\/span><\/p>\n<div class=\"w-separator size_small with_line width_default thick_1 style_solid color_border align_center\"><div class=\"w-separator-h\"><\/div><\/div>\n<h1><span class=\"ez-toc-section\" id=\"General_Setup\"><span style=\"font-weight: 400\">General Setup<\/span><\/span><\/h1>\n<p><span style=\"font-weight: 400\">OAuth v2 is the new version of the open protocol to allow secure authorization in a simple and standard method from web, mobile, and desktop applications. To use oAuth v2, you must first register an account with the web application as you will need the log-in credentials for that application to configure the settings for the Authorization Mechanism.<\/span><\/p>\n<p><span style=\"font-weight: 400\">To begin your configuration, follow the steps below:<\/span><\/p>\n<ol>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Select the <\/span><strong>VA <\/strong><span style=\"font-weight: 400\">you want to work with.<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Go to <\/span><strong>Build &gt; Conversation Skills &gt; Alert Tasks<\/strong><span style=\"font-weight: 400\">.&nbsp;<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Select the <\/span><strong>task <\/strong><span style=\"font-weight: 400\">you want to work with.&nbsp;<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Click the <\/span><strong>API Request<\/strong><span style=\"font-weight: 400\"> tab within the Alert Task.<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Expand the <\/span><strong>Authorization <\/strong><span style=\"font-weight: 400\">section and click <\/span><strong>Create New<\/strong><span style=\"font-weight: 400\"> to configure a new authorization.&nbsp;<br \/><a ref=\"magnificPopup\" href=\"https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-1\/wp-content\/uploads\/sites\/35\/20220928064550\/new-auth-1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large wp-image-45787\" src=\"https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-1\/wp-content\/uploads\/sites\/35\/20220928064550\/new-auth-1-1024x426.png\" alt=\"\" width=\"640\" height=\"266\" srcset=\"https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-1\/wp-content\/uploads\/sites\/35\/20220928064550\/new-auth-1-1024x426.png 1024w, https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-1\/wp-content\/uploads\/sites\/35\/20220928064550\/new-auth-1-300x125.png 300w, https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-1\/wp-content\/uploads\/sites\/35\/20220928064550\/new-auth-1.png 1145w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/a><\/span><\/li>\n<li style=\"font-weight: 400\">Next, the <strong>New Authorization Mechanism<\/strong> window opens, as shown in the illustration below.&nbsp;<br \/><a ref=\"magnificPopup\" href=\"https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-1\/wp-content\/uploads\/sites\/35\/20220928063347\/oauth2cred-auth.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large wp-image-45775\" src=\"https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-1\/wp-content\/uploads\/sites\/35\/20220928063347\/oauth2cred-auth-745x1024.png\" alt=\"\" width=\"469\" height=\"645\" srcset=\"https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-1\/wp-content\/uploads\/sites\/35\/20220928063347\/oauth2cred-auth-745x1024.png 745w, https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-1\/wp-content\/uploads\/sites\/35\/20220928063347\/oauth2cred-auth-218x300.png 218w, https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-1\/wp-content\/uploads\/sites\/35\/20220928063347\/oauth2cred-auth.png 786w\" sizes=\"auto, (max-width: 469px) 100vw, 469px\" \/><\/a><\/li>\n<\/ol>\n<p><span style=\"font-weight: 400\">To define a custom authorization, select <\/span><strong>oAuth v2 client credentials<\/strong><span style=\"font-weight: 400\"> in the <\/span><strong>Authorization Type<\/strong><span style=\"font-weight: 400\"> field, then configure each section as explained in the table below:<\/span><\/p>\n<table>\n<tbody>\n<tr>\n<th>\n<p><strong>FIELD NAME<\/strong><\/p>\n<\/th>\n<th>\n<p><strong>DESCRIPTION<\/strong><\/p>\n<\/th>\n<\/tr>\n<tr>\n<td>\n<p><span style=\"font-weight: 400\">Authorization Type<\/span><\/p>\n<\/td>\n<td>\n<p><span style=\"font-weight: 400\">Set to oAuth v2 Client Credentials.<\/span><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p><span style=\"font-weight: 400\">Identity Provider Name<\/span><\/p>\n<\/td>\n<td>\n<p><span style=\"font-weight: 400\">The name of the web application or web service, for example, <\/span><em><span style=\"font-weight: 400\">Asana<\/span><\/em><span style=\"font-weight: 400\">. This field is required.<\/span><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p><span style=\"font-weight: 400\">Client ID<\/span><\/p>\n<\/td>\n<td>\n<p><span style=\"font-weight: 400\">The ID of the Kore.ai client.<\/span><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p><span style=\"font-weight: 400\">Client Secret Key<\/span><\/p>\n<\/td>\n<td>\n<p><span style=\"font-weight: 400\">The value provided as the XO Platform authentication based on the Client ID to the web application.<\/span><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p><span style=\"font-weight: 400\">Token Request URL<\/span><\/p>\n<\/td>\n<td>\n<p><span style=\"font-weight: 400\">The URL used by the XO Platform to obtain an unauthorized request token. A request token is a value used by the XO Platform to obtain authorization from the end-user to obtain an access token. After end-user authorization, an access token can be requested by the XO Platform. This field is required.<\/span><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p><span style=\"font-weight: 400\">Scope<\/span><\/p>\n<\/td>\n<td>\n<p><span style=\"font-weight: 400\">If the web service requires additional values for authorization, add one or more Key\/Value pairs. For example, some Bot web services support using a scope key using read-only, write, or both as the value.<\/span><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p><span style=\"font-weight: 400\">Refresh Token URL<\/span><\/p>\n<\/td>\n<td>\n<p><span style=\"font-weight: 400\">Enter a Refresh Token URL, if required, for cases when the authentication token expires and has to be refreshed. Please see below for details.<\/span><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p><span style=\"font-weight: 400\">Description<\/span><\/p>\n<\/td>\n<td>\n<p><span style=\"font-weight: 400\">Enter a description for your authorization.&nbsp;<\/span><\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<div class=\"w-separator size_small with_line width_default thick_1 style_solid color_border align_center\"><div class=\"w-separator-h\"><\/div><\/div>\n<h1><span class=\"ez-toc-section\" id=\"Authorization\"><span style=\"font-weight: 400\">Authorization<\/span><\/span><\/h1>\n<p><span style=\"font-weight: 400\">By default, authorization fields are configured as part of the header of the task request message. If your task request requires additional authorization fields or the expected authorization is not part of the header, for example, a verification code, click<\/span><strong> + Add Authorization Field <\/strong><span style=\"font-weight: 400\">and then define the fields as shown in the following illustration.&nbsp;<\/span><\/p>\n<p><a ref=\"magnificPopup\" href=\"https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-1\/wp-content\/uploads\/sites\/35\/20220928063343\/auth-fields-1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-45772\" src=\"https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-1\/wp-content\/uploads\/sites\/35\/20220928063343\/auth-fields-1.png\" alt=\"\" width=\"785\" height=\"348\" srcset=\"https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-1\/wp-content\/uploads\/sites\/35\/20220928063343\/auth-fields-1.png 785w, https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-1\/wp-content\/uploads\/sites\/35\/20220928063343\/auth-fields-1-300x133.png 300w\" sizes=\"auto, (max-width: 785px) 100vw, 785px\" \/><\/a><\/p>\n<ol>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">In the <\/span><strong>Field Type<\/strong><span style=\"font-weight: 400\"> field, you can select one of the following depending on where in the task request message and the type of authorization fields that are required.<\/span><\/li>\n<ol>\n<li style=\"font-weight: 400\"><strong>Header<\/strong><span style=\"font-weight: 400\"> &ndash; The VA expects the authorization fields as part of the header of the request.<\/span><\/li>\n<li style=\"font-weight: 400\"><strong>Payload<\/strong><span style=\"font-weight: 400\"> &ndash; The VA expects the authorization fields as part of the content of the body of the request.<\/span><\/li>\n<li style=\"font-weight: 400\"><strong>Query String<\/strong><span style=\"font-weight: 400\"> &ndash; The VA expects the authorization fields as a query in the body of the request.<\/span><\/li>\n<li style=\"font-weight: 400\"><strong>Path Param<\/strong><span style=\"font-weight: 400\"> &ndash; The VA expects the authorization fields as part of the URL path for the request.<\/span><\/li>\n<\/ol>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">In the <\/span><strong>Field Key<\/strong><span style=\"font-weight: 400\"> field, enter the name of the field for the selected <\/span><strong>Field Type<\/strong><span style=\"font-weight: 400\">.<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">In the <\/span><strong>Field Value<\/strong><span style=\"font-weight: 400\"> field, enter the value for the <\/span><strong>Field Key<\/strong><span style=\"font-weight: 400\"> specified.<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Click <\/span><strong>Done<\/strong><span style=\"font-weight: 400\">. The new authorization field is added in the <\/span><strong>Authorization Fields<\/strong><span style=\"font-weight: 400\"> section.<br \/><\/span><\/li>\n<\/ol>\n<p><span style=\"font-weight: 400\">Click <\/span><strong>Save Auth<\/strong><span style=\"font-weight: 400\"> to save the authorization settings and close the <\/span><strong>New Authorization Mechanism<\/strong><span style=\"font-weight: 400\"> dialog.<\/span><\/p>\n<div class=\"w-separator size_small with_line width_default thick_1 style_solid color_border align_center\"><div class=\"w-separator-h\"><\/div><\/div>\n<h1><span class=\"ez-toc-section\" id=\"Testing\"><span style=\"font-weight: 400\">Testing<\/span><\/span><\/h1>\n<p><span style=\"font-weight: 400\">After you save the authorization, you can test it using the <\/span><strong>Authorization<\/strong><span style=\"font-weight: 400\"> page.<\/span><\/p>\n<ol>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Click <\/span><strong>Test Authorization<\/strong><span style=\"font-weight: 400\"> before continuing to develop the remaining steps of your task.<\/span><a ref=\"magnificPopup\" href=\"https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-1\/wp-content\/uploads\/sites\/35\/20220928064424\/test-authorization-1-1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-45784\" src=\"https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-1\/wp-content\/uploads\/sites\/35\/20220928064424\/test-authorization-1-1.png\" alt=\"\" width=\"885\" height=\"193\" srcset=\"https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-1\/wp-content\/uploads\/sites\/35\/20220928064424\/test-authorization-1-1.png 977w, https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-1\/wp-content\/uploads\/sites\/35\/20220928064424\/test-authorization-1-1-300x65.png 300w\" sizes=\"auto, (max-width: 885px) 100vw, 885px\" \/><\/a><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">After you click <\/span><strong>Test Authorization<\/strong><span style=\"font-weight: 400\">, the test is executed using the authentication token URLs and the <\/span><strong>Client ID<\/strong><span style=\"font-weight: 400\"> and <\/span><strong>Client Secret Key<\/strong><span style=\"font-weight: 400\">. If the tenancy was defined, the <\/span><strong>Test Authorization<\/strong><span style=\"font-weight: 400\"> window is displayed as shown in the following illustration.<\/span><span style=\"font-weight: 400\"><br \/><\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Click <\/span><strong>Test<\/strong><span style=\"font-weight: 400\"> to begin the authorization test. When the validation of authentication is complete, the <\/span><strong>Test Authorization<\/strong><span style=\"font-weight: 400\"> window is closed and the results of the validation, either success or failure, is displayed to the immediate right of the <\/span><strong>Test Authorization<\/strong><span style=\"font-weight: 400\"> button. If the authorization fails, the <\/span><em><span style=\"font-weight: 400\">Auth Test Failed<\/span><\/em><span style=\"font-weight: 400\"> message is displayed along with the <\/span><strong>Headers<\/strong><span style=\"font-weight: 400\"> and <\/span><strong>Response<\/strong><span style=\"font-weight: 400\"> tabs as shown in the following illustration.<\/span><span style=\"font-weight: 400\"><br \/><\/span><\/li>\n<\/ol>\n<ol>\n<ol>&lt;\/ol<\/ol>\n<\/ol>\n<p><a ref=\"magnificPopup\" href=\"https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-1\/wp-content\/uploads\/sites\/35\/20220928064715\/test-failure.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-45790\" src=\"https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-1\/wp-content\/uploads\/sites\/35\/20220928064715\/test-failure.png\" alt=\"\" width=\"578\" height=\"409\" srcset=\"https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-1\/wp-content\/uploads\/sites\/35\/20220928064715\/test-failure.png 578w, https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-1\/wp-content\/uploads\/sites\/35\/20220928064715\/test-failure-300x212.png 300w\" sizes=\"auto, (max-width: 578px) 100vw, 578px\" \/><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>We have seen how an Alert Task can be set up in the Kore.ai XO Platform here. In this article, we will see how authorization for alert tasks can be set up using the OAuth v2 with client credentials. General Setup OAuth v2 is the new version of the open protocol to allow secure authorization&#8230;<\/p>\n","protected":false},"author":27,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-45771","post","type-post","status-publish","format-standard","hentry","category-uncategorised"],"_links":{"self":[{"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/posts\/45771","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/users\/27"}],"replies":[{"embeddable":true,"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/comments?post=45771"}],"version-history":[{"count":1,"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/posts\/45771\/revisions"}],"predecessor-version":[{"id":45793,"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/posts\/45771\/revisions\/45793"}],"wp:attachment":[{"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/media?parent=45771"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/categories?post=45771"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/tags?post=45771"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}