<?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: Getting Access Token in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/Getting-Access-Token/m-p/404046#M252262</link>
    <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/124718"&gt;@BuffaloDaddy&lt;/a&gt;&amp;nbsp;Welcome to the Cloudera Community!&lt;BR /&gt;&lt;BR /&gt;To help you get the best possible solution, I have tagged our NiFi experts&amp;nbsp;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/35454"&gt;@MattWho&lt;/a&gt;&amp;nbsp;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/80381"&gt;@SAMSAL&lt;/a&gt;&amp;nbsp;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/20288"&gt;@Shelton&lt;/a&gt;&amp;nbsp; who may be able to assist you further.&lt;BR /&gt;&lt;BR /&gt;Please keep us updated on your post, and we hope you find a satisfactory solution to your query.&lt;/P&gt;</description>
    <pubDate>Thu, 13 Mar 2025 20:17:52 GMT</pubDate>
    <dc:creator>DianaTorres</dc:creator>
    <dc:date>2025-03-13T20:17:52Z</dc:date>
    <item>
      <title>Getting Access Token</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Getting-Access-Token/m-p/404032#M252261</link>
      <description>&lt;P&gt;Hi. I'm new to working with Apache Nifi. Currently, I've Apache Nifi 2.3.0&lt;/P&gt;&lt;P&gt;I'm trying to get access_token so that I can use it in future API calls. Currently, I use Postman to test getting access_token value and it works. I want to do this via Nifi.&lt;/P&gt;&lt;P&gt;Here is what I setup Postman to get access_token&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I'm currently using Postman in order to call an API that generates access_token that I will use later to call other APIs. I want to do the same using Apachi Nifi 2.3.0. The Apache Nifi should generate a file called tokens.txt that contains the access token. &lt;EM&gt;&lt;STRONG&gt;Here is what I do in Postman:&lt;/STRONG&gt;&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P data-unlink="true"&gt;&lt;SPAN&gt;POST URL:&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://URL/auth/token" target="_blank"&gt;https://URL/auth/token&lt;/A&gt;&lt;/P&gt;&lt;P data-unlink="true"&gt;&lt;STRONG&gt;Headers:&lt;/STRONG&gt;&lt;/P&gt;&lt;P data-unlink="true"&gt;&lt;SPAN&gt;&lt;EM&gt;&lt;STRONG&gt;Content-Type:&lt;/STRONG&gt;&lt;/EM&gt; application/x-www-form-urlencoded;charset=UTF-8 &lt;/SPAN&gt;&lt;/P&gt;&lt;P data-unlink="true"&gt;&lt;SPAN&gt;&lt;EM&gt;&lt;STRONG&gt;Authorization:&lt;/STRONG&gt;&lt;/EM&gt; Basic &amp;lt;BASE_64_ENCODED_CLIENT_CREDENTIALS&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P data-unlink="true"&gt;&lt;STRONG&gt;Body:&lt;/STRONG&gt;&lt;/P&gt;&lt;P data-unlink="true"&gt;&lt;SPAN&gt;&lt;EM&gt;&lt;STRONG&gt;grant_type:&lt;/STRONG&gt;&lt;/EM&gt; client_credentials&lt;/SPAN&gt;&lt;/P&gt;&lt;P data-unlink="true"&gt;The response is in JSON format and contains the access token, expiration time of the access token.&lt;BR /&gt;Here is an example response:&lt;BR /&gt;{&lt;BR /&gt;"access_token": "eyJ4NXQjUzI1NiI...KtK5elB38rcAbgFtVP9A",&lt;BR /&gt;"token_type": "Bearer",&lt;BR /&gt;"expires_in": 3600&lt;BR /&gt;}&lt;/P&gt;&lt;P data-unlink="true"&gt;&amp;nbsp;&lt;/P&gt;&lt;P data-unlink="true"&gt;What do I need to achieve?&lt;/P&gt;&lt;P data-unlink="true"&gt;I want to simulate the above in Apache Nifi where I get the access_token and then store it in a file. Every time a new access token arrives, it needs to re-write the value.&lt;/P&gt;&lt;P data-unlink="true"&gt;I tried to use the following components&lt;/P&gt;&lt;P data-unlink="true"&gt;&lt;SPAN&gt;GenerateFlowFile -&amp;gt; EncodeContent -&amp;gt; UpdateAttribute (headers and body) -&amp;gt; InvokeHTTP -&amp;gt; LogAttribute (API-Response) -&amp;gt; EvaluateJsonPath -&amp;gt; UpdateAttribute (filename) -&amp;gt; PutFile&lt;/SPAN&gt;&lt;/P&gt;&lt;P data-unlink="true"&gt;&amp;nbsp;&lt;/P&gt;&lt;P data-unlink="true"&gt;&lt;SPAN&gt;But for some reason, the InvokeHTTP was not working (not getting the response in JSON format).&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Mar 2025 16:05:10 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Getting-Access-Token/m-p/404032#M252261</guid>
      <dc:creator>BuffaloDaddy</dc:creator>
      <dc:date>2025-03-13T16:05:10Z</dc:date>
    </item>
    <item>
      <title>Re: Getting Access Token</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Getting-Access-Token/m-p/404046#M252262</link>
      <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/124718"&gt;@BuffaloDaddy&lt;/a&gt;&amp;nbsp;Welcome to the Cloudera Community!&lt;BR /&gt;&lt;BR /&gt;To help you get the best possible solution, I have tagged our NiFi experts&amp;nbsp;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/35454"&gt;@MattWho&lt;/a&gt;&amp;nbsp;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/80381"&gt;@SAMSAL&lt;/a&gt;&amp;nbsp;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/20288"&gt;@Shelton&lt;/a&gt;&amp;nbsp; who may be able to assist you further.&lt;BR /&gt;&lt;BR /&gt;Please keep us updated on your post, and we hope you find a satisfactory solution to your query.&lt;/P&gt;</description>
      <pubDate>Thu, 13 Mar 2025 20:17:52 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Getting-Access-Token/m-p/404046#M252262</guid>
      <dc:creator>DianaTorres</dc:creator>
      <dc:date>2025-03-13T20:17:52Z</dc:date>
    </item>
    <item>
      <title>Re: Getting Access Token</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Getting-Access-Token/m-p/404065#M252264</link>
      <description>&lt;P&gt;Thanks &lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/93628"&gt;@DianaTorres&lt;/a&gt;&amp;nbsp;. So, let me give more details about my issue. Below is how my process group look like:&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;1) GenerateFlowFile Processor:&lt;/STRONG&gt;&lt;/EM&gt; I define there the attributes that I want to pass in InvokeHTTP processor. This includes:&lt;/P&gt;&lt;UL class="lia-list-style-type-disc"&gt;&lt;LI&gt;Authorization&lt;/LI&gt;&lt;LI&gt;content-type&lt;/LI&gt;&lt;LI&gt;grant_type&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;2) LogAttribute-BeforeINVOKE:&lt;/STRONG&gt; &lt;/EM&gt;This processor is to log attributes in Logfile before HTTPInvoke&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;3) InvokeHTTP:&lt;/STRONG&gt;&lt;/EM&gt; This processor is where I make API call to get access_token. (Screenshots below). I've the property Request Body Enabled set as true.&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;4) LogAttribute-AFTERINVOKE:&lt;/STRONG&gt; &lt;/EM&gt;This processor is to log attributes in Logfile after HTTPInvoke&lt;/P&gt;&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;My observations:&amp;nbsp;&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;If I make the request using curl "e.g.&amp;nbsp;curl -X POST &lt;A href="https://SERVER_NAME/auth/token" target="_blank"&gt;https://SERVER_NAME/auth/token&lt;/A&gt; -H "Content-Type: application/x-www-form-urlencoded;charset=UTF-8" -H "authorization: Basic CLIENT_SECRET_VALUE" -d "grant_type=client_credentials", I get access_token.&lt;/LI&gt;&lt;LI&gt;I'm suspecting that InvokeHTTP processor when sending the request, some of the parameters might be not parsed properly because of special characters in content-type or authorization.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;I hope that&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/35454" target="_blank"&gt;@MattWho&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;or&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/80381" target="_blank"&gt;@SAMSAL&lt;/A&gt;&amp;nbsp;or&amp;nbsp;&lt;A href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/20288" target="_blank"&gt;@Shelton&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;can help me with this. It's driving me crazy.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="BuffaloDaddy_0-1741929804684.png" style="width: 400px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/44276i1A62D98075A499BD/image-size/medium?v=v2&amp;amp;px=400" role="button" title="BuffaloDaddy_0-1741929804684.png" alt="BuffaloDaddy_0-1741929804684.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="BuffaloDaddy_3-1741930421274.png" style="width: 400px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/44279i407FBA79A8F0A6AD/image-size/medium?v=v2&amp;amp;px=400" role="button" title="BuffaloDaddy_3-1741930421274.png" alt="BuffaloDaddy_3-1741930421274.png" /&gt;&lt;/span&gt;&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="BuffaloDaddy_1-1741930049540.png" style="width: 400px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/44277i560ED55A49079468/image-size/medium?v=v2&amp;amp;px=400" role="button" title="BuffaloDaddy_1-1741930049540.png" alt="BuffaloDaddy_1-1741930049540.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="BuffaloDaddy_2-1741930148703.png" style="width: 400px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/44278iA3791D6C38FA6AFE/image-size/medium?v=v2&amp;amp;px=400" role="button" title="BuffaloDaddy_2-1741930148703.png" alt="BuffaloDaddy_2-1741930148703.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Attributes of InvokeHTTP (SEND)&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="BuffaloDaddy_4-1741930787650.png" style="width: 400px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/44280i0B954DB25450C0F2/image-size/medium?v=v2&amp;amp;px=400" role="button" title="BuffaloDaddy_4-1741930787650.png" alt="BuffaloDaddy_4-1741930787650.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Attributes of InvokeHTTP (&lt;SPAN&gt;ATTRIBUTES_MODIFIED&lt;/SPAN&gt;)&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="BuffaloDaddy_5-1741930975480.png" style="width: 400px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/44281i55C5878A3151DEE3/image-size/medium?v=v2&amp;amp;px=400" role="button" title="BuffaloDaddy_5-1741930975480.png" alt="BuffaloDaddy_5-1741930975480.png" /&gt;&lt;/span&gt;&lt;/P&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;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 14 Mar 2025 05:49:17 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Getting-Access-Token/m-p/404065#M252264</guid>
      <dc:creator>BuffaloDaddy</dc:creator>
      <dc:date>2025-03-14T05:49:17Z</dc:date>
    </item>
    <item>
      <title>Re: Getting Access Token</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Getting-Access-Token/m-p/404261#M252294</link>
      <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/124718"&gt;@BuffaloDaddy&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What method of user authentication is configured in your NiFi?&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Single-user&lt;/LI&gt;&lt;LI&gt;ldap-provider&lt;/LI&gt;&lt;LI&gt;Kerberos-provider&lt;/LI&gt;&lt;LI&gt;etc?&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Thank you,&lt;BR /&gt;Matt&lt;/P&gt;</description>
      <pubDate>Mon, 17 Mar 2025 13:24:18 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Getting-Access-Token/m-p/404261#M252294</guid>
      <dc:creator>MattWho</dc:creator>
      <dc:date>2025-03-17T13:24:18Z</dc:date>
    </item>
  </channel>
</rss>

