{"id":46172,"date":"2022-09-29T10:53:31","date_gmt":"2022-09-29T09:53:31","guid":{"rendered":"https:\/\/developer.kore.ai\/v10-1\/?p=46172"},"modified":"2023-05-18T08:19:18","modified_gmt":"2023-05-18T07:19:18","slug":"bot-oauthv2-clientcredentials","status":"publish","type":"post","link":"https:\/\/developer.kore.ai\/v10-1\/docs\/bots\/advanced-topics\/authorization\/bot-oauthv2-clientcredentials\/","title":{"rendered":"Setting Up Authorization using OAuth v2 client credentials"},"content":{"rendered":"<p><span style=\"font-weight: 400\">OAuth v2 is the new version of the open protocol to allow secure authorization via a standard method from web, mobile, and desktop applications.<\/span><\/p>\n<p><span style=\"font-weight: 400\">To use oAuth v2, you must first register an account with the web application as you will need the sign in credentials for that application to configure the settings for the Authorization Mechanism.<\/span><\/p>\n<p><span style=\"font-weight: 400\">The Client Credentials grant type is used when applications request an access token to access their own resources, not on behalf of a user.<\/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=\"Configuring_oAuth_v2_Using_Client_Credentials\"><span style=\"font-weight: 400\">Configuring oAuth v2 Using Client Credentials<\/span><\/span><\/h1>\n<p><span style=\"font-weight: 400\">To configure this audialog opensthorization method for your assistant, follow these steps:<\/span><\/p>\n<ol>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Open the assistant for which you want to configure an Authorization profile.<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Select the <\/span><strong>Build<\/strong><span style=\"font-weight: 400\"> tab from the top menu.<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">From the left menu, click <\/span><strong>Configurations &gt; Authorization Profiles.<\/strong><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Click<\/span><strong> Add<\/strong><span style=\"font-weight: 400\">. The <\/span><strong>New Authorization Mechanism<\/strong><span style=\"font-weight: 400\"> dialog opens.<br \/><\/span><a ref=\"magnificPopup\" href=\"https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-1\/wp-content\/uploads\/sites\/35\/20220929104608\/add-authorization-1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large wp-image-46182\" src=\"https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-1\/wp-content\/uploads\/sites\/35\/20220929104608\/add-authorization-1-1024x456.png\" alt=\"\" width=\"640\" height=\"285\" srcset=\"https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-1\/wp-content\/uploads\/sites\/35\/20220929104608\/add-authorization-1-1024x456.png 1024w, https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-1\/wp-content\/uploads\/sites\/35\/20220929104608\/add-authorization-1-300x134.png 300w, https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-1\/wp-content\/uploads\/sites\/35\/20220929104608\/add-authorization-1.png 1922w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/a><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">In the <\/span><strong>Authorization Type<\/strong><span style=\"font-weight: 400\"> drop-down list, select <\/span><strong>auth v2 client credentials<\/strong><span style=\"font-weight: 400\">.<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">In the <\/span><strong>Name<\/strong><span style=\"font-weight: 400\"> field, enter the name for your authorization.<\/span><\/li>\n<\/ol>\n<p><span style=\"font-weight: 400\">The following illustration shows the <\/span><strong>oAuth v2<\/strong><span style=\"font-weight: 400\"> fields that you must define to enable authorization for your assistant.<\/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\/20220929104556\/oauth2cred-auth-1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large wp-image-46176\" src=\"https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-1\/wp-content\/uploads\/sites\/35\/20220929104556\/oauth2cred-auth-1-745x1024.png\" alt=\"\" width=\"568\" height=\"781\" srcset=\"https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-1\/wp-content\/uploads\/sites\/35\/20220929104556\/oauth2cred-auth-1-745x1024.png 745w, https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-1\/wp-content\/uploads\/sites\/35\/20220929104556\/oauth2cred-auth-1-218x300.png 218w, https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-1\/wp-content\/uploads\/sites\/35\/20220929104556\/oauth2cred-auth-1.png 786w\" sizes=\"auto, (max-width: 568px) 100vw, 568px\" \/><\/a><\/p>\n<p><span style=\"font-weight: 400\">Please define the fields as explained in the following table:<\/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. The XO Platform accepts a maximum length of 255 characters.<\/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 Kore.ai application authentication based on the Client ID to the web application. The XO Platform accepts a maximum length of 255 characters.<\/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 Kore.ai application to obtain an unauthorized request token. A request token is a value used by the Kore.ai application to obtain authorization from the end-user to obtain an access token. The XO Platform accepts a valid URL with a maximum length of 3000 characters. After end-user authorization, an access token can be requested by the Kore.ai application. 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 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. The XO Platform accepts a valid URL with a maximum length of 3000 characters.<\/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_Fields\"><span style=\"font-weight: 400\">Authorization Fields<\/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\/20220929104549\/auth-fields-2.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-46173\" src=\"https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-1\/wp-content\/uploads\/sites\/35\/20220929104549\/auth-fields-2.png\" alt=\"\" width=\"496\" height=\"220\" srcset=\"https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-1\/wp-content\/uploads\/sites\/35\/20220929104549\/auth-fields-2.png 785w, https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-1\/wp-content\/uploads\/sites\/35\/20220929104549\/auth-fields-2-300x133.png 300w\" sizes=\"auto, (max-width: 496px) 100vw, 496px\" \/><\/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.<\/span><\/li>\n<\/ol>\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_the_Authorization\"><span style=\"font-weight: 400\">Testing the Authorization<\/span><\/span><\/h1>\n<p><span style=\"font-weight: 400\">After you save the authentication, you can test your authorization definition on the <\/span><strong>Authentication<\/strong><span style=\"font-weight: 400\"> page when you click <\/span><strong>Test <\/strong><span style=\"font-weight: 400\">before continuing to develop the remaining steps of your task. When you click <\/span><strong>Test<\/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 tenancy was defined, the <\/span><strong>Test Authorization<\/strong><span style=\"font-weight: 400\"> dialog is displayed.<\/span><\/p>\n<p><span style=\"font-weight: 400\">Click <\/span><strong>Test<\/strong><span style=\"font-weight: 400\"> to begin the authorization test.&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\/20220929104602\/test-auth-1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large wp-image-46179\" src=\"https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-1\/wp-content\/uploads\/sites\/35\/20220929104602\/test-auth-1-1024x434.png\" alt=\"\" width=\"640\" height=\"271\" srcset=\"https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-1\/wp-content\/uploads\/sites\/35\/20220929104602\/test-auth-1-1024x434.png 1024w, https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-1\/wp-content\/uploads\/sites\/35\/20220929104602\/test-auth-1-300x127.png 300w, https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-1\/wp-content\/uploads\/sites\/35\/20220929104602\/test-auth-1.png 1922w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/a><\/p>\n<p><span style=\"font-weight: 400\">When the validation of authorization is complete, the results of the validation, either success or failure, are displayed. 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><\/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\/20220929105140\/failed-test.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-46185\" src=\"https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-1\/wp-content\/uploads\/sites\/35\/20220929105140\/failed-test.png\" alt=\"\" width=\"498\" height=\"396\" srcset=\"https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-1\/wp-content\/uploads\/sites\/35\/20220929105140\/failed-test.png 595w, https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-1\/wp-content\/uploads\/sites\/35\/20220929105140\/failed-test-300x238.png 300w\" sizes=\"auto, (max-width: 498px) 100vw, 498px\" \/><\/a><\/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<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>OAuth v2 is the new version of the open protocol to allow secure authorization via a 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 sign in credentials for that application to configure the settings for the&#8230;<\/p>\n","protected":false},"author":27,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[18],"tags":[],"class_list":["post-46172","post","type-post","status-publish","format-standard","hentry","category-authorization"],"_links":{"self":[{"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/posts\/46172","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=46172"}],"version-history":[{"count":6,"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/posts\/46172\/revisions"}],"predecessor-version":[{"id":57079,"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/posts\/46172\/revisions\/57079"}],"wp:attachment":[{"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/media?parent=46172"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/categories?post=46172"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/tags?post=46172"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}