{"id":93317,"date":"2020-08-25T15:13:26","date_gmt":"2020-08-25T06:13:26","guid":{"rendered":"https:\/\/support.questetra.com\/?p=93317"},"modified":"2026-04-14T15:20:50","modified_gmt":"2026-04-14T06:20:50","slug":"questetra-oauth2-settings-2020","status":"publish","type":"post","link":"https:\/\/support.questetra.com\/en\/developer-blog\/questetra-oauth2-settings-2020\/","title":{"rendered":"How to Set OAuth2 When Utilizing REST API"},"content":{"rendered":"<div class=\"su-note\"  style=\"border-color:#e5e54c;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\"><div class=\"su-note-inner su-u-clearfix su-u-trim\" style=\"background-color:#FFFF66;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\">\n<h4><i class=\"fal fa-exclamation-circle\"><\/i> There is a new article about this content<\/h4>\n<div style=\"text-align: center;\"><i class=\"fal fa-truck fa-lg\"><\/i> <a href=\"https:\/\/support.questetra.com\/en\/developer-blog\/http-auth-setting\/\">Understanding HTTP Authorization Settings<\/a><\/div>\n<\/div><\/div>\n\n\n\n<figure class=\"wp-block-image size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"58\" data-attachment-id=\"113212\" data-permalink=\"https:\/\/support.questetra.com\/en\/developer-blog\/message-start-event-http-browser\/attachment\/professional-banner-new-en\/\" data-orig-file=\"https:\/\/i0.wp.com\/support.questetra.com\/wp-content\/uploads\/2018\/12\/professional-banner-new-en.png?fit=1200%2C68&amp;ssl=1\" data-orig-size=\"1200,68\" data-comments-opened=\"0\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"professional-banner-new-en\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/support.questetra.com\/wp-content\/uploads\/2018\/12\/professional-banner-new-en.png?fit=1024%2C58&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/support.questetra.com\/wp-content\/uploads\/2018\/12\/professional-banner-new-en-1024x58.png?resize=1024%2C58&#038;ssl=1\" alt=\"\" class=\"wp-image-113212\" srcset=\"https:\/\/i0.wp.com\/support.questetra.com\/wp-content\/uploads\/2018\/12\/professional-banner-new-en.png?resize=1024%2C58&amp;ssl=1 1024w, https:\/\/i0.wp.com\/support.questetra.com\/wp-content\/uploads\/2018\/12\/professional-banner-new-en.png?resize=600%2C34&amp;ssl=1 600w, https:\/\/i0.wp.com\/support.questetra.com\/wp-content\/uploads\/2018\/12\/professional-banner-new-en.png?resize=768%2C44&amp;ssl=1 768w, https:\/\/i0.wp.com\/support.questetra.com\/wp-content\/uploads\/2018\/12\/professional-banner-new-en.png?w=1200&amp;ssl=1 1200w\" sizes=\"auto, (max-width: 1000px) 100vw, 1000px\" \/><\/figure>\n\n\n\n<div style=\"height:50px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">Hi there,<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">A common example of system integration is to call the REST API of another service by sending an HTTP request from Questetra BPM Suite. Since many APIs use OAuth2 as their authentication method, I&#8217;ll describe how to run Questetra as an OAuth2 client in this article.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">You can send an HTTP request using one of the following modeling elements via Questetra BPM Suite:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><a href=\"https:\/\/questetra.zendesk.com\/hc\/en-us\/articles\/360002245572-M225\">Throwing Message Intermediate Event (HTTP)<\/a><\/li><li><a href=\"https:\/\/questetra.zendesk.com\/hc\/en-us\/articles\/360002260611-M230\">Script Task<\/a><\/li><li><a href=\"https:\/\/questetra.zendesk.com\/hc\/en-us\/articles\/360010635012\">Service Task definition (Add-on XML)<\/a><ul><ul><li>Any HTTP request that is defined in OAuth2<\/li><\/ul><\/ul><\/li><\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Although there are several types of OAuth2, if you use Authorization code as its <em>grant-type<\/em> Questetra can support it just by having some settings configured.<\/p>\n\n\n<div class=\"su-box su-box-style-soft\" id=\"\" style=\"border-color:#006199;border-radius:10px;max-width:none\"><div class=\"su-box-title\" style=\"background-color:#3394cc;color:#000000;border-top-left-radius:8px;border-top-right-radius:8px\">ToC<\/div><div class=\"su-box-content su-u-clearfix su-u-trim\" style=\"border-bottom-left-radius:8px;border-bottom-right-radius:8px\">\n1. Overview of the procedure<br \/>\n2. Preparing the partner service to be invoked<br \/>\n3. Settings on the invoking side (Questetra)<br \/>\n4. Configuring modelling elements for OAuth connection<br \/>\n5. Examples of grant-types other than Authorization Code<\/div><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">1. Overview of the procedure<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The overview of the settings procedure is as follows.<\/p>\n\n\n<ol>\n<li><span style=\"font-weight: 400;\">Preparing the partner service to be invoked<\/span><span style=\"font-weight: 400;\"><br><\/span><span style=\"font-weight: 400;\">Setting up using Questetra\u2019s Callback URL, obtaining a Client ID and Secret<\/span><\/li>\n<li><span style=\"font-weight: 400;\">Settings on the invoking side (Questetra)<\/span><span style=\"font-weight: 400;\"><br><\/span>Set up and obtain a token using the partner service&#8217;s endpoint URL and the Client ID and Secret<\/li>\n<li><span style=\"font-weight: 400;\">Settings in Questetra for invoking API<\/span><span style=\"font-weight: 400;\"><br><\/span><span style=\"font-weight: 400;\">Setting up using the OAuth token that has been obtained<\/span><\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n\n\n<h3 class=\"wp-block-heading\">2. Preparing the partner service to be invoked<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">On the side of the partner service to be invoked, the client\u2019s registration in advance is required (sometimes referred to as App registration). <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In this case, Questetra\u2019s callback URL is required (sometimes referred to as the \u201credirect URI\u201d).<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Workflow platforms of Basic \/ Advanced \/ Professional<br> \u2192   https:\/\/<strong>s<\/strong>.questetra.net\/oauth2callback<\/li><li>Workflow platforms of Trial of each edition (Free)<br> \u2192  https:\/\/<strong>f<\/strong>.questetra.net\/oauth2callback<\/li><\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">When you complete the registration, as the Client ID and Client Secret are displayed, make a note of them (they may be called Consumer Key or APP ID \/ Client Secret Code or Consumer Secret, etc.).<\/p>\n\n\n<p>&nbsp;<\/p>\n\n\n<h3 class=\"wp-block-heading\">3. Settings on the invoking side (Questetra)<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">First,&nbsp; Select OAuth 2.0 Setting in the \u25bc App drop-down menu on the App detail screen<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"733\" height=\"504\" data-attachment-id=\"93864\" data-permalink=\"https:\/\/support.questetra.com\/en\/developer-blog\/questetra-oauth2-settings-2020\/attachment\/how-to-set-oauth2-when-utilizing-rest-api-1\/\" data-orig-file=\"https:\/\/i0.wp.com\/support.questetra.com\/wp-content\/uploads\/2020\/08\/How-to-Set-OAuth2-When-Utilizing-REST-API-1.png?fit=733%2C504&amp;ssl=1\" data-orig-size=\"733,504\" data-comments-opened=\"0\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"How to Set OAuth2 When Utilizing REST API 1\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/support.questetra.com\/wp-content\/uploads\/2020\/08\/How-to-Set-OAuth2-When-Utilizing-REST-API-1.png?fit=733%2C504&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/support.questetra.com\/wp-content\/uploads\/2020\/08\/How-to-Set-OAuth2-When-Utilizing-REST-API-1.png?resize=733%2C504&#038;ssl=1\" alt=\"\" class=\"wp-image-93864\" srcset=\"https:\/\/i0.wp.com\/support.questetra.com\/wp-content\/uploads\/2020\/08\/How-to-Set-OAuth2-When-Utilizing-REST-API-1.png?w=733&amp;ssl=1 733w, https:\/\/i0.wp.com\/support.questetra.com\/wp-content\/uploads\/2020\/08\/How-to-Set-OAuth2-When-Utilizing-REST-API-1.png?resize=458%2C315&amp;ssl=1 458w\" sizes=\"auto, (max-width: 733px) 100vw, 733px\" \/><\/figure><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">Click on the [Add] button to open the details settings screen. (You can confirm the Callback URL in this screen.)<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Enter each item and click on [Save].<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"929\" height=\"356\" data-attachment-id=\"93867\" data-permalink=\"https:\/\/support.questetra.com\/en\/developer-blog\/questetra-oauth2-settings-2020\/attachment\/how-to-set-oauth2-when-utilizing-rest-api-2\/\" data-orig-file=\"https:\/\/i0.wp.com\/support.questetra.com\/wp-content\/uploads\/2020\/08\/How-to-Set-OAuth2-When-Utilizing-REST-API-2.png?fit=929%2C356&amp;ssl=1\" data-orig-size=\"929,356\" data-comments-opened=\"0\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"How to Set OAuth2 When Utilizing REST API 2\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/support.questetra.com\/wp-content\/uploads\/2020\/08\/How-to-Set-OAuth2-When-Utilizing-REST-API-2.png?fit=929%2C356&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/support.questetra.com\/wp-content\/uploads\/2020\/08\/How-to-Set-OAuth2-When-Utilizing-REST-API-2.png?resize=929%2C356&#038;ssl=1\" alt=\"\" class=\"wp-image-93867\" srcset=\"https:\/\/i0.wp.com\/support.questetra.com\/wp-content\/uploads\/2020\/08\/How-to-Set-OAuth2-When-Utilizing-REST-API-2.png?w=929&amp;ssl=1 929w, https:\/\/i0.wp.com\/support.questetra.com\/wp-content\/uploads\/2020\/08\/How-to-Set-OAuth2-When-Utilizing-REST-API-2.png?resize=600%2C230&amp;ssl=1 600w, https:\/\/i0.wp.com\/support.questetra.com\/wp-content\/uploads\/2020\/08\/How-to-Set-OAuth2-When-Utilizing-REST-API-2.png?resize=768%2C294&amp;ssl=1 768w\" sizes=\"auto, (max-width: 929px) 100vw, 929px\" \/><\/figure><\/div>\n\n\n<table class=\"table table-bordered table-hover\">\n<thead>\n<tr>\n<th width=\"120\"><b>Item name<\/b><\/th>\n<th width=\"200\">Value<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><span style=\"font-weight: 400;\">Config Name<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Can be any name you want. To be used for designation later.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">Authorization Endpoint URL, Token Endpoint URL<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Enter by referring to the manuals of the partner service<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">Scope<\/span><\/td>\n<td><span style=\"font-weight: 400;\">It depends on the partner service and the calling API. There are cases where it is not specified. Separate with a space in case of multiple names.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">Client ID, Consumer Secret<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Enter the aforementioned notes you made when registering to the partner service.<\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n\n\n<p class=\"wp-block-paragraph\">Once you have saved the settings click on the \u201cGet token\u201d button; you will be asked to log in the service (if you have already logged in to the other party&#8217;s service using your browser, the login screen is not displayed). After you log in to the service, you will be requested to authorize access to the resource. If you are successful you will see the following display.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"928\" height=\"181\" data-attachment-id=\"93870\" data-permalink=\"https:\/\/support.questetra.com\/en\/developer-blog\/questetra-oauth2-settings-2020\/attachment\/how-to-set-oauth2-when-utilizing-rest-api-3\/\" data-orig-file=\"https:\/\/i0.wp.com\/support.questetra.com\/wp-content\/uploads\/2020\/08\/How-to-Set-OAuth2-When-Utilizing-REST-API-3.png?fit=928%2C181&amp;ssl=1\" data-orig-size=\"928,181\" data-comments-opened=\"0\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"How to Set OAuth2 When Utilizing REST API 3\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/support.questetra.com\/wp-content\/uploads\/2020\/08\/How-to-Set-OAuth2-When-Utilizing-REST-API-3.png?fit=928%2C181&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/support.questetra.com\/wp-content\/uploads\/2020\/08\/How-to-Set-OAuth2-When-Utilizing-REST-API-3.png?resize=928%2C181&#038;ssl=1\" alt=\"\" class=\"wp-image-93870\" srcset=\"https:\/\/i0.wp.com\/support.questetra.com\/wp-content\/uploads\/2020\/08\/How-to-Set-OAuth2-When-Utilizing-REST-API-3.png?w=928&amp;ssl=1 928w, https:\/\/i0.wp.com\/support.questetra.com\/wp-content\/uploads\/2020\/08\/How-to-Set-OAuth2-When-Utilizing-REST-API-3.png?resize=600%2C117&amp;ssl=1 600w, https:\/\/i0.wp.com\/support.questetra.com\/wp-content\/uploads\/2020\/08\/How-to-Set-OAuth2-When-Utilizing-REST-API-3.png?resize=768%2C150&amp;ssl=1 768w\" sizes=\"auto, (max-width: 928px) 100vw, 928px\" \/><\/figure><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">If you get an error here please check if there are any incomplete settings. If the settings are all correct there is a possibility that the authorization flow is not supported by Questetra, so please check the OAuth communication documentation of the other party&#8217;s service.<\/p>\n\n\n<p>&nbsp;<\/p>\n\n\n<h3 class=\"wp-block-heading\">4. Configuring modelling elements for OAuth connection<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The OAuth token obtained above is used by specifying it in the following modeling elements.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">4.1. Throwing Message Intermediate Event (HTTP)<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">In the Header tab select the Authorizaton Header OAuth2 and specify the name of the  OAuth2 you set in the Section 3. <br>You can send an HTTP request using an OAuth token.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"772\" height=\"508\" data-attachment-id=\"93873\" data-permalink=\"https:\/\/support.questetra.com\/en\/developer-blog\/questetra-oauth2-settings-2020\/attachment\/how-to-set-oauth2-when-utilizing-rest-api-4\/\" data-orig-file=\"https:\/\/i0.wp.com\/support.questetra.com\/wp-content\/uploads\/2020\/08\/How-to-Set-OAuth2-When-Utilizing-REST-API-4.png?fit=772%2C508&amp;ssl=1\" data-orig-size=\"772,508\" data-comments-opened=\"0\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"How to Set OAuth2 When Utilizing REST API 4\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/support.questetra.com\/wp-content\/uploads\/2020\/08\/How-to-Set-OAuth2-When-Utilizing-REST-API-4.png?fit=772%2C508&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/support.questetra.com\/wp-content\/uploads\/2020\/08\/How-to-Set-OAuth2-When-Utilizing-REST-API-4.png?resize=772%2C508&#038;ssl=1\" alt=\"\" class=\"wp-image-93873\" srcset=\"https:\/\/i0.wp.com\/support.questetra.com\/wp-content\/uploads\/2020\/08\/How-to-Set-OAuth2-When-Utilizing-REST-API-4.png?w=772&amp;ssl=1 772w, https:\/\/i0.wp.com\/support.questetra.com\/wp-content\/uploads\/2020\/08\/How-to-Set-OAuth2-When-Utilizing-REST-API-4.png?resize=479%2C315&amp;ssl=1 479w, https:\/\/i0.wp.com\/support.questetra.com\/wp-content\/uploads\/2020\/08\/How-to-Set-OAuth2-When-Utilizing-REST-API-4.png?resize=768%2C505&amp;ssl=1 768w\" sizes=\"auto, (max-width: 772px) 100vw, 772px\" \/><\/figure><\/div>\n\n\n\n<h4 class=\"wp-block-heading\">4.2 Script Task<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">The following code retrieves the token obtained in OAuth2 Configuration and sends an HTTP request:<\/p>\n\n\n<pre><code>const token = httpClient.getOAuth2Token( XXX_OAuth <span style=\"font-weight: 400;\">Config Name<\/span>_XXX );\nhttpClient.begin().bearer(token);<\/code><\/pre>\n\n\n<h4 class=\"wp-block-heading\">4.3. Service Task definition (Add-on XML)<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">The setting item name is specified by the OAuth2 communication permission setting name, etc. (the config item name is just an example as it depends on the specification of the Service Task definition (Add-on XML)).<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"748\" height=\"508\" data-attachment-id=\"93875\" data-permalink=\"https:\/\/support.questetra.com\/en\/developer-blog\/questetra-oauth2-settings-2020\/attachment\/how-to-set-oauth2-when-utilizing-rest-api-5\/\" data-orig-file=\"https:\/\/i0.wp.com\/support.questetra.com\/wp-content\/uploads\/2020\/08\/How-to-Set-OAuth2-When-Utilizing-REST-API-5.png?fit=748%2C508&amp;ssl=1\" data-orig-size=\"748,508\" data-comments-opened=\"0\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"How to Set OAuth2 When Utilizing REST API 5\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/support.questetra.com\/wp-content\/uploads\/2020\/08\/How-to-Set-OAuth2-When-Utilizing-REST-API-5.png?fit=748%2C508&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/support.questetra.com\/wp-content\/uploads\/2020\/08\/How-to-Set-OAuth2-When-Utilizing-REST-API-5.png?resize=748%2C508&#038;ssl=1\" alt=\"\" class=\"wp-image-93875\" srcset=\"https:\/\/i0.wp.com\/support.questetra.com\/wp-content\/uploads\/2020\/08\/How-to-Set-OAuth2-When-Utilizing-REST-API-5.png?w=748&amp;ssl=1 748w, https:\/\/i0.wp.com\/support.questetra.com\/wp-content\/uploads\/2020\/08\/How-to-Set-OAuth2-When-Utilizing-REST-API-5.png?resize=464%2C315&amp;ssl=1 464w\" sizes=\"auto, (max-width: 748px) 100vw, 748px\" \/><\/figure><\/div>\n\n\n<p>&nbsp;<\/p>\n\n\n<h3 class=\"wp-block-heading\">5. Examples of grant-types other than Authorization Code<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">If the OAuth2 grant-type that is available on the other service is <em>password\/client _ credentials<\/em>, you can use a Script Task to retrieve the token. To find out which grant-type is supported by the other party&#8217;s service please refer to the document of the service you are using.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In either case, you have to register Questetra as an OAuth2 client on the other side (see Section 2).<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">5.1.&nbsp;Example of grant-type: password<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">The following code is a sample with which you send a request to API.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">You can change the expressions in the &#8220;{}&#8221; depending on the other service and settings.<\/p>\n\n\n<pre><code>const clientId = \"{ClientID}\";\nconst secret = \"{Client secret}\";\nlet accessLog = \"\";\n\n\/\/Retrieve the token\nconst uriToken = \"{Token endpoint URL}\";\nconst response = httpClient.begin()\n  .formParam( \"grant_type\", \"password\" )\n  .formParam( \"client_id\", clientId )\n  .formParam( \"client_secret\", secret )\n  .formParam( \"scope\", \"write read follow\" )\n  .formParam( \"username\", \"{Login username}\" )\n  .formParam( \"password\", \"{Login password}\" )\n  .post( uriToken );\naccessLog += \"---POST request--- \" + response.getStatusCode() + \"\\n\";\naccessLog += response.getResponseAsString() + \"\\n\";\nconst oauthTokenObj = JSON.parse( response.getResponseAsString() );\nconst oauthToken = oauthTokenObj.access_token;\naccessLog += \"oauthToken: \" + oauthToken + \"\\n\";\n\n\/\/<span style=\"font-weight: 400;\">Send a request to API\uff08in the case of POST request\uff09<\/span>\nconst uriExecute = \"{API endpoint URL}\";\nconst responseExecute = httpClient.begin()\n  .bearer( oauthToken )\n  .formParam() \/\/ <span style=\"font-weight: 400;\">Set in accordance with API<\/span>\n  .post( uriExecute );\naccessLog += \"---POST request--- \" + responseExecute.getStatusCode() + \"\\n\";\naccessLog += responseExecute.getResponseAsString() + \"\\n\";\n\nengine.setDataByVarName(\"q_accesslog\", accessLog);\n<\/code><\/pre>\n\n\n<h4 class=\"wp-block-heading\">5.2. Example of grant-type: client_credentials<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">The following code is a sample when you retrieve the token (*you can send a request to API with the code in the same way as <em>grant-type: password<\/em>).<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">You can change the expressions in the &#8220;{}&#8221; depending on the other service and settings.<\/p>\n\n\n<pre><code>const clientId = \"{ClientID}\";\nconst secret = \"{Client secret}\";\nlet accessLog = \"\";\n\n\/\/Retrieve the token\nconst uriToken = \"{Token endpoint URL}\";\nconst response = httpClient.begin()\n  .formParam( \"grant_type\", \"client_credentials\" )\n  .formParam( \"client_id\", clientId )\n  .formParam( \"client_secret\", secret )\n  .post( uriToken );\naccessLog += \"---POST request--- \" + response.getStatusCode() + \"\\n\";\naccessLog += response.getResponseAsString() + \"\\n\";\nconst oauthTokenObj = JSON.parse( response.getResponseAsString() );\nconst oauthToken = oauthTokenObj.access_token;\naccessLog += \"oauthToken: \" + oauthToken + \"\\n\";\n\n\/\/<span style=\"font-weight: 400;\">Send a request to API <\/span>\n\/\/<span style=\"font-weight: 400;\">The following is the same as grant-type: password <\/span>\n<\/code><\/pre>","protected":false},"excerpt":{"rendered":"<p>I&#8217;ll describe how to run Questetra as an OAuth2 client in this article.<\/p>\n","protected":false},"author":9,"featured_media":102438,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_coblocks_attr":"","_coblocks_dimensions":"","_coblocks_responsive_height":"","_coblocks_accordion_ie_support":"","_uag_custom_page_level_css":"","advanced_seo_description":"","jetpack_seo_html_title":"","jetpack_seo_noindex":false,"jetpack_seo_schema_type":"","_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_wpcom_ai_launchpad_first_post":false,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"{title}\n\n{excerpt}\n\n{url}","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"_wpas_customize_per_network":false,"jetpack_post_was_ever_published":false},"categories":[296],"tags":[],"class_list":["post-93317","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-developer-blog"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/support.questetra.com\/wp-content\/uploads\/2020\/08\/oauth-settings-1200x675-1.png?fit=1200%2C675&ssl=1","uagb_featured_image_src":{"full":["https:\/\/i0.wp.com\/support.questetra.com\/wp-content\/uploads\/2020\/08\/oauth-settings-1200x675-1.png?fit=1200%2C675&ssl=1",1200,675,false],"thumbnail":["https:\/\/i0.wp.com\/support.questetra.com\/wp-content\/uploads\/2020\/08\/oauth-settings-1200x675-1.png?resize=440%2C440&ssl=1",440,440,true],"medium":["https:\/\/i0.wp.com\/support.questetra.com\/wp-content\/uploads\/2020\/08\/oauth-settings-1200x675-1.png?fit=560%2C315&ssl=1",560,315,true],"medium_large":["https:\/\/i0.wp.com\/support.questetra.com\/wp-content\/uploads\/2020\/08\/oauth-settings-1200x675-1.png?fit=768%2C432&ssl=1",768,432,true],"large":["https:\/\/i0.wp.com\/support.questetra.com\/wp-content\/uploads\/2020\/08\/oauth-settings-1200x675-1.png?fit=1024%2C576&ssl=1",1024,576,true],"1536x1536":["https:\/\/i0.wp.com\/support.questetra.com\/wp-content\/uploads\/2020\/08\/oauth-settings-1200x675-1.png?fit=1200%2C675&ssl=1",1200,675,true],"2048x2048":["https:\/\/i0.wp.com\/support.questetra.com\/wp-content\/uploads\/2020\/08\/oauth-settings-1200x675-1.png?fit=1200%2C675&ssl=1",1200,675,true],"newspack-article-block-landscape-large":["https:\/\/i0.wp.com\/support.questetra.com\/wp-content\/uploads\/2020\/08\/oauth-settings-1200x675-1.png?resize=1200%2C675&ssl=1",1200,675,true],"newspack-article-block-portrait-large":["https:\/\/i0.wp.com\/support.questetra.com\/wp-content\/uploads\/2020\/08\/oauth-settings-1200x675-1.png?resize=900%2C675&ssl=1",900,675,true],"newspack-article-block-square-large":["https:\/\/i0.wp.com\/support.questetra.com\/wp-content\/uploads\/2020\/08\/oauth-settings-1200x675-1.png?resize=1200%2C675&ssl=1",1200,675,true],"newspack-article-block-landscape-medium":["https:\/\/i0.wp.com\/support.questetra.com\/wp-content\/uploads\/2020\/08\/oauth-settings-1200x675-1.png?resize=800%2C600&ssl=1",800,600,true],"newspack-article-block-portrait-medium":["https:\/\/i0.wp.com\/support.questetra.com\/wp-content\/uploads\/2020\/08\/oauth-settings-1200x675-1.png?resize=600%2C675&ssl=1",600,675,true],"newspack-article-block-square-medium":["https:\/\/i0.wp.com\/support.questetra.com\/wp-content\/uploads\/2020\/08\/oauth-settings-1200x675-1.png?resize=800%2C675&ssl=1",800,675,true],"newspack-article-block-landscape-intermediate":["https:\/\/i0.wp.com\/support.questetra.com\/wp-content\/uploads\/2020\/08\/oauth-settings-1200x675-1.png?resize=600%2C450&ssl=1",600,450,true],"newspack-article-block-portrait-intermediate":["https:\/\/i0.wp.com\/support.questetra.com\/wp-content\/uploads\/2020\/08\/oauth-settings-1200x675-1.png?resize=450%2C600&ssl=1",450,600,true],"newspack-article-block-square-intermediate":["https:\/\/i0.wp.com\/support.questetra.com\/wp-content\/uploads\/2020\/08\/oauth-settings-1200x675-1.png?resize=600%2C600&ssl=1",600,600,true],"newspack-article-block-landscape-small":["https:\/\/i0.wp.com\/support.questetra.com\/wp-content\/uploads\/2020\/08\/oauth-settings-1200x675-1.png?resize=400%2C300&ssl=1",400,300,true],"newspack-article-block-portrait-small":["https:\/\/i0.wp.com\/support.questetra.com\/wp-content\/uploads\/2020\/08\/oauth-settings-1200x675-1.png?resize=300%2C400&ssl=1",300,400,true],"newspack-article-block-square-small":["https:\/\/i0.wp.com\/support.questetra.com\/wp-content\/uploads\/2020\/08\/oauth-settings-1200x675-1.png?resize=400%2C400&ssl=1",400,400,true],"newspack-article-block-landscape-tiny":["https:\/\/i0.wp.com\/support.questetra.com\/wp-content\/uploads\/2020\/08\/oauth-settings-1200x675-1.png?resize=200%2C150&ssl=1",200,150,true],"newspack-article-block-portrait-tiny":["https:\/\/i0.wp.com\/support.questetra.com\/wp-content\/uploads\/2020\/08\/oauth-settings-1200x675-1.png?resize=150%2C200&ssl=1",150,200,true],"newspack-article-block-square-tiny":["https:\/\/i0.wp.com\/support.questetra.com\/wp-content\/uploads\/2020\/08\/oauth-settings-1200x675-1.png?resize=200%2C200&ssl=1",200,200,true],"newspack-article-block-uncropped":["https:\/\/i0.wp.com\/support.questetra.com\/wp-content\/uploads\/2020\/08\/oauth-settings-1200x675-1.png?fit=1200%2C675&ssl=1",1200,675,true]},"uagb_author_info":{"display_name":"Tsuyoshi Kusaka","author_link":"https:\/\/support.questetra.com\/en\/author\/kusaka0211\/"},"uagb_comment_info":3,"uagb_excerpt":"I'll describe how to run Questetra as an OAuth2 client in this article.","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p9DiIh-oh7","jetpack_likes_enabled":true,"jetpack-related-posts":[{"id":74512,"url":"https:\/\/support.questetra.com\/en\/developer-blog\/questetra-oauth2-settings\/","url_meta":{"origin":93317,"position":0},"title":"Settings when Calling REST API of Another Service from Questetra (Questetra to be OAuth2 client)","author":"Tsuyoshi Kusaka","date":"2019-01-23","format":false,"excerpt":"Describing in detail about how to set up to use OAuth when linking to other services from Questetra BPM Suite.","rel":"","context":"In &quot;Questetra Developers Blog&quot;","block_context":{"text":"Questetra Developers Blog","link":"https:\/\/support.questetra.com\/en\/category\/developer-blog\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/support.questetra.com\/wp-content\/uploads\/2020\/08\/oauth-settings-1200x675-1.png?fit=1200%2C675&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/support.questetra.com\/wp-content\/uploads\/2020\/08\/oauth-settings-1200x675-1.png?fit=1200%2C675&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/support.questetra.com\/wp-content\/uploads\/2020\/08\/oauth-settings-1200x675-1.png?fit=1200%2C675&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/support.questetra.com\/wp-content\/uploads\/2020\/08\/oauth-settings-1200x675-1.png?fit=1200%2C675&ssl=1&resize=700%2C400 2x, https:\/\/i0.wp.com\/support.questetra.com\/wp-content\/uploads\/2020\/08\/oauth-settings-1200x675-1.png?fit=1200%2C675&ssl=1&resize=1050%2C600 3x"},"classes":[]},{"id":84944,"url":"https:\/\/support.questetra.com\/en\/developer-blog\/freee-questetra\/","url_meta":{"origin":93317,"position":1},"title":"API Settings Between the Accounting Software freee and Questetra","author":"Tsuyoshi Kusaka","date":"2020-03-05","format":false,"excerpt":"I summarized the methods of Questetra BPM Suite's connection with freee, an accounting software via REST API","rel":"","context":"In &quot;Questetra Developers Blog&quot;","block_context":{"text":"Questetra Developers Blog","link":"https:\/\/support.questetra.com\/en\/category\/developer-blog\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/support.questetra.com\/wp-content\/uploads\/2020\/03\/freee-questetra.png?fit=1200%2C675&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/support.questetra.com\/wp-content\/uploads\/2020\/03\/freee-questetra.png?fit=1200%2C675&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/support.questetra.com\/wp-content\/uploads\/2020\/03\/freee-questetra.png?fit=1200%2C675&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/support.questetra.com\/wp-content\/uploads\/2020\/03\/freee-questetra.png?fit=1200%2C675&ssl=1&resize=700%2C400 2x, https:\/\/i0.wp.com\/support.questetra.com\/wp-content\/uploads\/2020\/03\/freee-questetra.png?fit=1200%2C675&ssl=1&resize=1050%2C600 3x"},"classes":[]},{"id":81990,"url":"https:\/\/support.questetra.com\/en\/developer-blog\/office365-app-regist-2\/","url_meta":{"origin":93317,"position":2},"title":"Application Registration Procedure in Office 365 for Linking Office 365 and Questetra Cloud Workflow with API","author":"Tsuyoshi Kusaka","date":"2019-10-31","format":false,"excerpt":"Explanation of the application registration procedure for API integration with Office365 and OAuth","rel":"","context":"In &quot;Questetra Developers Blog&quot;","block_context":{"text":"Questetra Developers Blog","link":"https:\/\/support.questetra.com\/en\/category\/developer-blog\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/support.questetra.com\/wp-content\/uploads\/2019\/10\/office365-questetra-eyecatch.png?fit=1200%2C675&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/support.questetra.com\/wp-content\/uploads\/2019\/10\/office365-questetra-eyecatch.png?fit=1200%2C675&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/support.questetra.com\/wp-content\/uploads\/2019\/10\/office365-questetra-eyecatch.png?fit=1200%2C675&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/support.questetra.com\/wp-content\/uploads\/2019\/10\/office365-questetra-eyecatch.png?fit=1200%2C675&ssl=1&resize=700%2C400 2x, https:\/\/i0.wp.com\/support.questetra.com\/wp-content\/uploads\/2019\/10\/office365-questetra-eyecatch.png?fit=1200%2C675&ssl=1&resize=1050%2C600 3x"},"classes":[]},{"id":75378,"url":"https:\/\/support.questetra.com\/en\/developer-blog\/onedrive-questetra\/","url_meta":{"origin":93317,"position":3},"title":"How to Output Files from Cloud-based Workflow Questetra to OneDrive","author":"Tsuyoshi Kusaka","date":"2019-03-06","format":false,"excerpt":"Summary of connection settings (file output) for Questetra BPM Suite to OneDrive","rel":"","context":"In &quot;Questetra Developers Blog&quot;","block_context":{"text":"Questetra Developers Blog","link":"https:\/\/support.questetra.com\/en\/category\/developer-blog\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/support.questetra.com\/wp-content\/uploads\/2019\/03\/onedrive-questetra-1200x675-1.png?fit=1200%2C675&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/support.questetra.com\/wp-content\/uploads\/2019\/03\/onedrive-questetra-1200x675-1.png?fit=1200%2C675&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/support.questetra.com\/wp-content\/uploads\/2019\/03\/onedrive-questetra-1200x675-1.png?fit=1200%2C675&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/support.questetra.com\/wp-content\/uploads\/2019\/03\/onedrive-questetra-1200x675-1.png?fit=1200%2C675&ssl=1&resize=700%2C400 2x, https:\/\/i0.wp.com\/support.questetra.com\/wp-content\/uploads\/2019\/03\/onedrive-questetra-1200x675-1.png?fit=1200%2C675&ssl=1&resize=1050%2C600 3x"},"classes":[]},{"id":82634,"url":"https:\/\/support.questetra.com\/en\/system-settings\/api-clients\/","url_meta":{"origin":93317,"position":4},"title":"System Settings &#8211; API Clients","author":"Peter Glover","date":"2024-04-25","format":false,"excerpt":"Configure Basic Authentication and OAuth2 for use with Questetra APIs.","rel":"","context":"In &quot;System Settings&quot;","block_context":{"text":"System Settings","link":"https:\/\/support.questetra.com\/en\/category\/system-settings\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/support.questetra.com\/wp-content\/uploads\/2020\/03\/System-Settings-API-Clients.png?fit=1200%2C675&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/support.questetra.com\/wp-content\/uploads\/2020\/03\/System-Settings-API-Clients.png?fit=1200%2C675&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/support.questetra.com\/wp-content\/uploads\/2020\/03\/System-Settings-API-Clients.png?fit=1200%2C675&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/support.questetra.com\/wp-content\/uploads\/2020\/03\/System-Settings-API-Clients.png?fit=1200%2C675&ssl=1&resize=700%2C400 2x, https:\/\/i0.wp.com\/support.questetra.com\/wp-content\/uploads\/2020\/03\/System-Settings-API-Clients.png?fit=1200%2C675&ssl=1&resize=1050%2C600 3x"},"classes":[]},{"id":75577,"url":"https:\/\/support.questetra.com\/en\/developer-blog\/docusign-questetra\/","url_meta":{"origin":93317,"position":5},"title":"Setting Up API Cooperation between Electronic Signature System DocuSign and Cloud-based Workflow Questetra","author":"Tsuyoshi Kusaka","date":"2019-03-13","format":false,"excerpt":"Described how to connect Questetra BPM Suite with DocuSign, an Electronic Signature system, via REST API.","rel":"","context":"In &quot;Questetra Developers Blog&quot;","block_context":{"text":"Questetra Developers Blog","link":"https:\/\/support.questetra.com\/en\/category\/developer-blog\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/support.questetra.com\/wp-content\/uploads\/2019\/03\/docusign-questetra-1200x675-1.png?fit=1200%2C675&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/support.questetra.com\/wp-content\/uploads\/2019\/03\/docusign-questetra-1200x675-1.png?fit=1200%2C675&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/support.questetra.com\/wp-content\/uploads\/2019\/03\/docusign-questetra-1200x675-1.png?fit=1200%2C675&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/support.questetra.com\/wp-content\/uploads\/2019\/03\/docusign-questetra-1200x675-1.png?fit=1200%2C675&ssl=1&resize=700%2C400 2x, https:\/\/i0.wp.com\/support.questetra.com\/wp-content\/uploads\/2019\/03\/docusign-questetra-1200x675-1.png?fit=1200%2C675&ssl=1&resize=1050%2C600 3x"},"classes":[]}],"amp_enabled":false,"_links":{"self":[{"href":"https:\/\/support.questetra.com\/en\/wp-json\/wp\/v2\/posts\/93317","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/support.questetra.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/support.questetra.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/support.questetra.com\/en\/wp-json\/wp\/v2\/users\/9"}],"replies":[{"embeddable":true,"href":"https:\/\/support.questetra.com\/en\/wp-json\/wp\/v2\/comments?post=93317"}],"version-history":[{"count":71,"href":"https:\/\/support.questetra.com\/en\/wp-json\/wp\/v2\/posts\/93317\/revisions"}],"predecessor-version":[{"id":118489,"href":"https:\/\/support.questetra.com\/en\/wp-json\/wp\/v2\/posts\/93317\/revisions\/118489"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/support.questetra.com\/en\/wp-json\/wp\/v2\/media\/102438"}],"wp:attachment":[{"href":"https:\/\/support.questetra.com\/en\/wp-json\/wp\/v2\/media?parent=93317"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/support.questetra.com\/en\/wp-json\/wp\/v2\/categories?post=93317"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/support.questetra.com\/en\/wp-json\/wp\/v2\/tags?post=93317"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}