<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question Re: How to get a token from invokeHTTP to use it in another invokeHTTP without losing the flow content in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/How-to-get-a-token-from-invokeHTTP-to-use-it-in-another/m-p/371296#M240945</link>
    <description>&lt;P&gt;I used a global variable (&lt;SPAN&gt;DistributedMapCacheClientService &amp;amp;&amp;nbsp;DistributedMapCacheServer)&lt;/SPAN&gt;&amp;nbsp;and a separate process group to run each 2 min to get a token then store that token in my global variable and use it in the header of my OnBoard API and each time i get a 403 error I loopback my flow file to request new token to use&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;UpdateAttribute before the InvokeHTTP is used to get the exact token text from the full response from the oauth API&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="FediMannoubi_0-1684766530532.png" style="width: 400px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/37647i50A7FBB334248A6A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="FediMannoubi_0-1684766530532.png" alt="FediMannoubi_0-1684766530532.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;DIV class="setting"&gt;&lt;DIV class="setting-field"&gt;&lt;SPAN&gt;InvokeHTTP&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="setting-field"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="FediMannoubi_1-1684766563296.png" style="width: 400px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/37648i5EFA89EB7652DBAE/image-size/medium?v=v2&amp;amp;px=400" role="button" title="FediMannoubi_1-1684766563296.png" alt="FediMannoubi_1-1684766563296.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;DIV&gt;Get Auth Token (Cycle)&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="FediMannoubi_2-1684766581349.png" style="width: 400px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/37649iD5254833526D9109/image-size/medium?v=v2&amp;amp;px=400" role="button" title="FediMannoubi_2-1684766581349.png" alt="FediMannoubi_2-1684766581349.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 22 May 2023 14:47:06 GMT</pubDate>
    <dc:creator>FediMannoubi</dc:creator>
    <dc:date>2023-05-22T14:47:06Z</dc:date>
    <item>
      <title>How to get a token from invokeHTTP to use it in another invokeHTTP without losing the flow content</title>
      <link>https://community.cloudera.com/t5/Support-Questions/How-to-get-a-token-from-invokeHTTP-to-use-it-in-another/m-p/369448#M240491</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;I have the following :&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Tomcat server (local)&lt;/LI&gt;&lt;LI&gt;Nifi (local)&lt;/LI&gt;&lt;LI&gt;customer csv file&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;In my flow I am getting the file content and transforming it to a json body (the body I need to send it in the API post).&lt;/P&gt;&lt;P&gt;The problem is to use the invokeHTTP processor to send the api (onboard) I need to get a token via another API (auth) and add it in the header of the main api (onboard).&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="FediMannoubi_0-1682503278277.png" style="width: 400px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/37375i1C2074A1D6650099/image-size/medium?v=v2&amp;amp;px=400" role="button" title="FediMannoubi_0-1682503278277.png" alt="FediMannoubi_0-1682503278277.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Auth API :&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sends a json to the tomcat :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;{
    "user_name": "User",
    "password": "Password"
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And get a json with a token valid for 2 min&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;{
    "id": 1,
    "user_name": "user",
    "token": "eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJzdXBlcmFkbWluIiwidGV...",
    "roles": [
        "USER",
        "ADMIN"
    ],
    "homePage": null,
    "priorite": 0
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The problem is when I pass the customers json to the auth API it will take that json as the body for that API and I lose my customer json.&lt;/P&gt;&lt;P&gt;Is there another way to get the token from the auth API and use it in the onboard API header without losing the customers json (main flow)?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 26 Apr 2023 10:08:00 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/How-to-get-a-token-from-invokeHTTP-to-use-it-in-another/m-p/369448#M240491</guid>
      <dc:creator>FediMannoubi</dc:creator>
      <dc:date>2023-04-26T10:08:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to get a token from invokeHTTP to use it in another invokeHTTP without losing the flow content</title>
      <link>https://community.cloudera.com/t5/Support-Questions/How-to-get-a-token-from-invokeHTTP-to-use-it-in-another/m-p/369719#M240542</link>
      <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/98126"&gt;@FediMannoubi&lt;/a&gt;&amp;nbsp;Get the required response data that you need from flowfile to an attribute with EvaluateJsonPath.&amp;nbsp; Do this for user, password, and token.&amp;nbsp; &amp;nbsp; &amp;nbsp;Once these&amp;nbsp; data values are attributes,&amp;nbsp; you can use them in the header, or write them back out to the flowfile content when appropriate.&lt;/P&gt;</description>
      <pubDate>Fri, 28 Apr 2023 12:13:09 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/How-to-get-a-token-from-invokeHTTP-to-use-it-in-another/m-p/369719#M240542</guid>
      <dc:creator>steven-matison</dc:creator>
      <dc:date>2023-04-28T12:13:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to get a token from invokeHTTP to use it in another invokeHTTP without losing the flow content</title>
      <link>https://community.cloudera.com/t5/Support-Questions/How-to-get-a-token-from-invokeHTTP-to-use-it-in-another/m-p/371296#M240945</link>
      <description>&lt;P&gt;I used a global variable (&lt;SPAN&gt;DistributedMapCacheClientService &amp;amp;&amp;nbsp;DistributedMapCacheServer)&lt;/SPAN&gt;&amp;nbsp;and a separate process group to run each 2 min to get a token then store that token in my global variable and use it in the header of my OnBoard API and each time i get a 403 error I loopback my flow file to request new token to use&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;UpdateAttribute before the InvokeHTTP is used to get the exact token text from the full response from the oauth API&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="FediMannoubi_0-1684766530532.png" style="width: 400px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/37647i50A7FBB334248A6A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="FediMannoubi_0-1684766530532.png" alt="FediMannoubi_0-1684766530532.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;DIV class="setting"&gt;&lt;DIV class="setting-field"&gt;&lt;SPAN&gt;InvokeHTTP&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="setting-field"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="FediMannoubi_1-1684766563296.png" style="width: 400px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/37648i5EFA89EB7652DBAE/image-size/medium?v=v2&amp;amp;px=400" role="button" title="FediMannoubi_1-1684766563296.png" alt="FediMannoubi_1-1684766563296.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;DIV&gt;Get Auth Token (Cycle)&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="FediMannoubi_2-1684766581349.png" style="width: 400px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/37649iD5254833526D9109/image-size/medium?v=v2&amp;amp;px=400" role="button" title="FediMannoubi_2-1684766581349.png" alt="FediMannoubi_2-1684766581349.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 22 May 2023 14:47:06 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/How-to-get-a-token-from-invokeHTTP-to-use-it-in-another/m-p/371296#M240945</guid>
      <dc:creator>FediMannoubi</dc:creator>
      <dc:date>2023-05-22T14:47:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to get a token from invokeHTTP to use it in another invokeHTTP without losing the flow content</title>
      <link>https://community.cloudera.com/t5/Support-Questions/How-to-get-a-token-from-invokeHTTP-to-use-it-in-another/m-p/371298#M240946</link>
      <description>&lt;P&gt;It sounds like you are using OAuth, which means you ought to be using an OAuth2AccessTokenProvider controller service.&amp;nbsp; See my screen shot, which shows that inside the InvokeHTTP there is a configuration line that lets you specify this controller service.&amp;nbsp; This service automatically handles getting the token for you and embedding it in the header so your flowfile remains intact.&amp;nbsp; This will greatly simplify your current flow because you can get rid of the map cache and that whole process cycle.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ChuckE_0-1684767128083.png" style="width: 400px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/37650i27D66688566833C4/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ChuckE_0-1684767128083.png" alt="ChuckE_0-1684767128083.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 22 May 2023 14:58:04 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/How-to-get-a-token-from-invokeHTTP-to-use-it-in-another/m-p/371298#M240946</guid>
      <dc:creator>ChuckE</dc:creator>
      <dc:date>2023-05-22T14:58:04Z</dc:date>
    </item>
  </channel>
</rss>

