{"id":17947,"date":"2016-12-05T21:45:57","date_gmt":"2016-12-05T21:45:57","guid":{"rendered":"https:\/\/developer.kore.com\/?post_type=docs&#038;p=9113"},"modified":"2021-03-18T10:13:30","modified_gmt":"2021-03-18T10:13:30","slug":"setting-up-authorization-using-oauth-v1","status":"publish","type":"post","link":"https:\/\/developer.kore.ai\/v8-1\/docs\/bots\/advanced-topics\/authorization\/setting-up-authorization-using-oauth-v1\/","title":{"rendered":"Setting Up Authorization using OAuth v1"},"content":{"rendered":"<section class=\"l-section wpb_row height_auto\"><div class=\"l-section-h i-cf\"><div class=\"g-cols vc_row type_default valign_top\"><div class=\"vc_col-sm-12 wpb_column vc_column_container\"><div class=\"vc_column-inner\"><div class=\"wpb_wrapper\">\r\n\t<div class=\"wpb_text_column \">\r\n\t\t<div class=\"wpb_wrapper\">\r\n\t\t\t<p>OAuth v1 is an open protocol to allow secure authorization in a simple and standard method from web, mobile, and desktop applications.<\/p>\n<p>To use OAuth v1, you must first register an account with the web application as you will need the login credentials for that application to configure the settings for the authorization mechanism.<\/p>\n\r\n\t\t<\/div>\r\n\t<\/div>\r\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>\r\n\t<div class=\"wpb_text_column \">\r\n\t\t<div class=\"wpb_wrapper\">\r\n\t\t\t<h2><span class=\"ez-toc-section\" id=\"How_OAuth_v1_Works\"><span class=\"wysiwyg-font-size-large\">How OAuth v1 Works<\/span><\/span><\/h2>\n<ol>\n<li>The Kore.ai application\u00a0obtains an unauthorized request token from the web application.<\/li>\n<li>The Kore.ai\u00a0application redirects the user to a login dialog at the web application.<\/li>\n<li>The user authorizes the request token, associating it with their account.<\/li>\n<li>The web application\u00a0redirects the user back to the Kore.ai application.<\/li>\n<li>The Kore.ai application\u00a0exchanges the request token for an access token.<\/li>\n<li>The access token allows the Kore.ai application\u00a0to access a protected resource at the provider, on behalf of the user.<\/li>\n<\/ol>\n\r\n\t\t<\/div>\r\n\t<\/div>\r\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>\r\n\t<div class=\"wpb_text_column \">\r\n\t\t<div class=\"wpb_wrapper\">\r\n\t\t\t<h2><span class=\"ez-toc-section\" id=\"Configuration\">Configuration<\/span><\/h2>\n<p>To define Authorization for your bot, follow these steps:<\/p>\n<ol>\n<li>Open the bot for which you want to configure an Authorization profile.<\/li>\n<li>Hover over the left-side navigation panel and from <strong>Settings -&gt; Config Settings<\/strong> select <strong>Authorization Profile<\/strong><br \/>\n<a ref=\"magnificPopup\" href=\"\/wp-content\/uploads\/sites\/18\/auth-profiles.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-21924\" src=\"\/wp-content\/uploads\/sites\/18\/auth-profiles.png\" alt=\"\" width=\"349\" height=\"569\" srcset=\"https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/wp-content\/uploads\/sites\/18\/20221201101820\/auth-profiles.png 349w, https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/wp-content\/uploads\/sites\/18\/20221201101820\/auth-profiles-184x300.png 184w\" sizes=\"auto, (max-width: 349px) 100vw, 349px\" \/><\/a><\/li>\n<li>Click<strong> Add<\/strong>.\u00a0The <strong>New Authorization Mechanism<\/strong> dialog opens.<\/li>\n<li>In the <strong>Authorization Type<\/strong> drop-down list, select\u00a0<strong>oAuth v1<\/strong>.<\/li>\n<li>The following illustration is an example of the <strong>oAuth v1 <\/strong>authorization type fields that you must define to enable a customized authorization for your Bot.<br \/>\n<a ref=\"magnificPopup\" href=\"\/wp-content\/uploads\/sites\/18\/First-screen.png\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-14718 alignnone\" src=\"\/wp-content\/uploads\/sites\/18\/First-screen.png\" alt=\"\" width=\"454\" height=\"486\" \/><\/a><\/li>\n<\/ol>\n<p>To define oAuth v1, define the fields described in the following table.<\/p>\n<table width=\"474\">\n<thead>\n<tr>\n<th class=\"wysiwyg-text-align-left\">FIELD NAME<\/th>\n<th class=\"wysiwyg-text-align-left\">DESCRIPTION<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>Authorization Type<\/td>\n<td>Set to <strong>oAuth v1<\/strong>.<\/td>\n<\/tr>\n<tr>\n<td>Callback URL<\/td>\n<td>The URL used by the web application or web service to redirect the end-user after end-user authorization is complete. This value, <span style=\"color: #0000ff\">https:\/\/idp.kore.ai\/workflows\/callback\/<\/span>, \u00a0is provided as a read-only value by the Kore.ai application when you define oAuth v1 settings.<\/td>\n<\/tr>\n<tr>\n<td>Identity Provider Name<\/td>\n<td>The name of the web application or web service, for example, <em>Twitter<\/em>. This field is required.<\/td>\n<\/tr>\n<tr>\n<td>Consumer Key<\/td>\n<td>The value provided as the Kore.ai application\u00a0identification to the web application.\u00a0This field is required.<\/td>\n<\/tr>\n<tr>\n<td>Consumer Secret<\/td>\n<td>The secret value\u00a0provided by the Kore.ai application\u00a0to establish ownership of the <strong>Consumer Key<\/strong>.\u00a0This field is required.<\/td>\n<\/tr>\n<tr>\n<td>Request Token Link<\/td>\n<td>The URL used by the Kore.ai application to obtain an unauthorized request token. The request token is a value used by the Kore.ai application\u00a0to obtain authorization from the end-user to obtain an access token. For example, <span style=\"color: #0000ff\">https:\/\/{tenant}.someCompany.com\/oauth\/request_token<\/span>. After end-user authorization, an access token can be requested by the Kore.ai application.\u00a0This field is required.<\/td>\n<\/tr>\n<tr>\n<td>Access Token Link<\/td>\n<td>The URL used to exchange the end-user\u00a0authorized request token for an access token. The access token is the\u00a0value used by the Kore.ai application\u00a0to gain access to the web application or web service\u00a0on behalf of the end-user, instead of using the end-user credentials. For example, <span style=\"color: #0000ff\">https:\/\/{tenant}.someCompany.com\/oauth\/access_token<\/span>. This field is required.<\/td>\n<\/tr>\n<tr>\n<td>User Authorization Link<\/td>\n<td>This is the URL used to obtain end-user\u00a0authorization for the Kore.ai application to access the web application or web service using the access token.\u00a0This field is required. You can use dynamic fields, path parameter fields, query fields, and so forth, to define the Authorization\u00a0URL, for example,<br \/>\n<span style=\"color: #0000ff\">\u00a0 \u00a0 \u00a0https:\/\/kore.someCompany.com\/sap\/opu\/odata\/sap\/{{authfield1}}\/?$format=json<br \/>\n<\/span>or<br \/>\n<span style=\"color: #0000ff\">\u00a0 \u00a0 \u00a0https:\/\/{tenant}.service-now.com\/api\/now\/v1\/table\/incident<\/span><br \/>\nFor more information, see <a href=\"\/v8-1\/docs\/bots\/bot-builder\/defining-bot-tasks\/using-session-and-context-variables-in-tasks\/\">Using Session and Context Variables in Tasks<\/a>.<\/td>\n<\/tr>\n<tr>\n<td>Access Using a Connector<\/td>\n<td>Select <strong>Yes<\/strong> to enable access for Kore.ai Bots using the Kore.ai Connector agent. This option is only visible if a Kore.ai Connector agent is configured and enabled in your enterprise on-premises network. For more information, see <a href=\"\/v8-1\/docs\/bots\/admin-console\/security-control\/security-module-overview\/#Why_Use_the_Koreai_Connector_for_Bots\">Using the Kore.ai Connector<\/a>.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n\r\n\t\t<\/div>\r\n\t<\/div>\r\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>\r\n\t<div class=\"wpb_text_column \">\r\n\t\t<div class=\"wpb_wrapper\">\r\n\t\t\t<h3><span class=\"ez-toc-section\" id=\"Defining_Tenancy\">Defining Tenancy<\/span><\/h3>\n<p>If\u00a0required, in the\u00a0<strong>Subdomain<\/strong>\u00a0section, select <strong>Yes<\/strong>\u00a0if the base URL for a web application or user interface the uses a\u00a0tenant name in the URL. For example,\u00a0<span style=\"color: #0000ff\">kore<\/span> is the tenant organization for a web service using tenants at <span style=\"color: #0000ff\">www.<strong><em>kore<\/em><\/strong>.someCompany.com.<\/span><\/p>\n<p>In the following example configuration, the tenancy URL contains the <span style=\"color: #0000ff\">{tenant}<\/span> organization placeholder.<br \/>\n<a ref=\"magnificPopup\" href=\"\/wp-content\/uploads\/sites\/18\/Tenancy.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-14719 alignnone\" src=\"\/wp-content\/uploads\/sites\/18\/Tenancy.png\" alt=\"\" width=\"557\" height=\"162\" \/><\/a><\/p>\n\r\n\t\t<\/div>\r\n\t<\/div>\r\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>\r\n\t<div class=\"wpb_text_column \">\r\n\t\t<div class=\"wpb_wrapper\">\r\n\t\t\t<h3><span class=\"ez-toc-section\" id=\"Adding_Additional_Fields\">Adding Additional Fields<\/span><\/h3>\n<p>Click <strong>Add<\/strong> to open the <strong>Additional Fields<\/strong> dialog and then enter one or more key\/value pairs that represent additional authorization input fields.<\/p>\n<p>If the default username and password fields do not meet your needs for authorization input, you can add custom fields as key\/value pairs that are displayed to the end-user by adding <strong>Additional Fields<\/strong>. You can use these fields, for example, if a PIN code is required in the authorization process, in addition to the <strong>Username<\/strong> and <strong>Password<\/strong> fields.<\/p>\n<p><strong>Additional Fields<\/strong> are added as shown in the following illustration.<br \/>\n<a ref=\"magnificPopup\" href=\"\/wp-content\/uploads\/sites\/18\/Additional-Fields.png\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-14720 alignnone\" src=\"\/wp-content\/uploads\/sites\/18\/Additional-Fields.png\" alt=\"\" width=\"555\" height=\"142\" \/><\/a><br \/>\nSpecify the following fields:<\/p>\n<ul>\n<li><strong>Field Key<\/strong> &#8211; The name of the custom field to specify for authorization.<\/li>\n<li><strong>Field Value<\/strong> &#8211; The value for the custom field to specify for authorization.<\/li>\n<li>Click <strong>Add<\/strong> to save the <strong>Additional Field<\/strong>.<\/li>\n<\/ul>\n<p>To add more <strong>Additional Fields<\/strong>, click <strong>Add<\/strong>\u00a0in the <strong>Additional Fields<\/strong> section.<\/p>\n\r\n\t\t<\/div>\r\n\t<\/div>\r\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>\r\n\t<div class=\"wpb_text_column \">\r\n\t\t<div class=\"wpb_wrapper\">\r\n\t\t\t<h3><span class=\"ez-toc-section\" id=\"Adding_Authorization_Fields\"><span class=\"wysiwyg-font-size-large\">Adding Authorization Fields<\/span><\/span><\/h3>\n<p>By default, no authorization fields are configured as part of the header of the Bot\u00a0request message. If your Bot\u00a0request requires authorization fields or the expected authorization is not part of the header, for example, social security number or PIN, click <strong>Add<\/strong>\u00a0in the <strong>Authorization Fields<\/strong> section and then define the fields as shown in the following illustration.<\/p>\n<p><a ref=\"magnificPopup\" href=\"\/wp-content\/uploads\/sites\/18\/Authorization-field.png\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-14721 alignnone\" src=\"\/wp-content\/uploads\/sites\/18\/Authorization-field.png\" alt=\"\" width=\"524\" height=\"213\" \/><\/a><\/p>\n<ol>\n<li>In the <strong>Field Type<\/strong> field, you can select one of the following depending on where in the Bot\u00a0request message and the type of authorization fields that are required.\n<ul>\n<li><strong>Header<\/strong> &#8211;\u00a0The Bot\u00a0expects the authorization fields as part of the header\u00a0of the request.<\/li>\n<li><strong>Payload<\/strong> &#8211; The Bot\u00a0expects the authorization fields as part of the content of the body of the request.<\/li>\n<li><strong>Query String<\/strong> &#8211;\u00a0The Bot\u00a0expects the authorization fields as a query in the body\u00a0of the request.<\/li>\n<li><strong>Path Param<\/strong> &#8211; The Bot expects the authorization fields as part of the URL path for the request.<\/li>\n<\/ul>\n<\/li>\n<li>In the <strong>Field Key<\/strong> field, enter the name of the field for the selected <strong>Field Type<\/strong>.<\/li>\n<li>In the <strong>Field Value<\/strong> field,\u00a0enter the value for the <strong>Field Key<\/strong> specified.<\/li>\n<li>Click <strong>Add<\/strong>. The new authorization field is added in the <strong>Authorization Fields<\/strong> section.<\/li>\n<\/ol>\n<p>To add additional authorization fields, click <strong>Add<\/strong>\u00a0in the <strong>Authorization\u00a0Fields<\/strong> section.<\/p>\n\r\n\t\t<\/div>\r\n\t<\/div>\r\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>\r\n\t<div class=\"wpb_text_column \">\r\n\t\t<div class=\"wpb_wrapper\">\r\n\t\t\t<h3><span class=\"ez-toc-section\" id=\"Testing_the_Authorization\"><span style=\"color: inherit\">Testing the Authorization<\/span><\/span><\/h3>\n<p>After you save the authorization, you can test your authorization definition on the <strong>Authorization<\/strong>\u00a0page when you click <strong>Test <\/strong>before continuing to develop the remain steps of your Bot. When you\u00a0click <strong>Test<\/strong>, the test is executed using the authorization token URLs and the <strong>Consumer Key<\/strong> and <strong>Consumer Token<\/strong>. If the tenancy was defined, the <strong>Test Authorization<\/strong> dialog is displayed.\u00a0Click <strong>Test<\/strong> to begin the authorization test.\u00a0When the validation of authorization is complete, the <strong>Test Authorization<\/strong> dialog is closed and the results of the validation, either success or failure, is displayed to the immediate right of the <strong>Test Authorization<\/strong> button. If the authorization fails, the <em>Auth Test Failed<\/em> message is displayed along with the <strong>Headers<\/strong> and <strong>Response<\/strong> tabs.\u00a0<a ref=\"magnificPopup\" href=\"\/wp-content\/uploads\/sites\/18\/DIYTestAuthorizationDialogFail.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-8684 alignnone\" src=\"\/wp-content\/uploads\/sites\/18\/DIYTestAuthorizationDialogFail.png\" alt=\"Test Authorization Failure Dialog\" width=\"595\" height=\"473\" \/><\/a><\/p>\n\r\n\t\t<\/div>\r\n\t<\/div>\r\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><\/div><\/div><\/div><\/div><\/div><\/section>\n","protected":false},"excerpt":{"rendered":"OAuth v1 is an open protocol to allow secure authorization in a simple and standard method from web, mobile, and desktop applications. To use OAuth v1, you must first register an account with the web application as you will need the login credentials for that application to configure the settings for the authorization mechanism. How...","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[18],"tags":[],"class_list":["post-17947","post","type-post","status-publish","format-standard","hentry","category-authorization"],"_links":{"self":[{"href":"https:\/\/developer.kore.ai\/v8-1\/wp-json\/wp\/v2\/posts\/17947","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/developer.kore.ai\/v8-1\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/developer.kore.ai\/v8-1\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/developer.kore.ai\/v8-1\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/developer.kore.ai\/v8-1\/wp-json\/wp\/v2\/comments?post=17947"}],"version-history":[{"count":5,"href":"https:\/\/developer.kore.ai\/v8-1\/wp-json\/wp\/v2\/posts\/17947\/revisions"}],"predecessor-version":[{"id":21934,"href":"https:\/\/developer.kore.ai\/v8-1\/wp-json\/wp\/v2\/posts\/17947\/revisions\/21934"}],"wp:attachment":[{"href":"https:\/\/developer.kore.ai\/v8-1\/wp-json\/wp\/v2\/media?parent=17947"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/developer.kore.ai\/v8-1\/wp-json\/wp\/v2\/categories?post=17947"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/developer.kore.ai\/v8-1\/wp-json\/wp\/v2\/tags?post=17947"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}