<?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>topic How to Authenticate the API for Windchill Odata connector in Thingworx when using SSO Authentication in ThingWorx Developers</title>
    <link>https://www.ptcusercommunity.com/t5/ThingWorx-Developers/How-to-Authenticate-the-API-for-Windchill-Odata-connector-in/m-p/1049296#M71081</link>
    <description>&lt;P&gt;Hi Folks,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a requirement to download the files of Windchill objects into Thingworx repository. I am getting the Link of files inside Thingworx using Odata Connectors. I am able to generate the file in Repository but when I try to open the file getting error "&lt;SPAN&gt;Failed to load PDF document.&lt;/SPAN&gt;"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Below is the code I am using :&lt;/P&gt;&lt;DIV&gt;// result: JSON&lt;/DIV&gt;&lt;DIV&gt;let inputJson = Things["ptc-windchill-integration-connector"].downloadAsZip({&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;respondWithZip: false /* BOOLEAN {"dataShape":""} */,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;$expand: undefined /* STRING {"dataShape":""} */,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; objectId: &amp;lt;objectId&amp;gt;&lt;/DIV&gt;&lt;DIV&gt;});&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;// result: JSON&lt;/DIV&gt;&lt;DIV&gt;let csrf = Things["Thing.ODataConnector.ProdMgmt_TH"].GetCSRFToken({&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;$select: undefined /* STRING {"dataShape":""} */&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;});&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; item = inputJson.items[0];&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;let params = {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;url: &amp;lt;file_url&amp;gt; /* STRING */ ,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;headers: {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;"CSRF_NONCE": &amp;lt;Nonce token&amp;gt;,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "Accept": "*/*",&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "X-Requested-With": "XMLHttpRequest"&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; };&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;// result: BLOB&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;let binaryContent = Resources["ContentLoaderFunctions"].LoadBinary(params);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; result = binaryContent;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; let fullPath = "/test4/" + item.name;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; Things["SupportRepository"].SaveBinary({&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;path: fullPath /* STRING */,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;content: binaryContent /* BLOB */&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;});&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;What is wrong in my code to authenticate it while downloading it in Thingworx Repository.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Thanks in advance.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Regards,&lt;/DIV&gt;&lt;DIV&gt;VV&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;</description>
    <pubDate>Mon, 29 Dec 2025 06:37:37 GMT</pubDate>
    <dc:creator>VV_14105315</dc:creator>
    <dc:date>2025-12-29T06:37:37Z</dc:date>
    <item>
      <title>How to Authenticate the API for Windchill Odata connector in Thingworx when using SSO Authentication</title>
      <link>https://www.ptcusercommunity.com/t5/ThingWorx-Developers/How-to-Authenticate-the-API-for-Windchill-Odata-connector-in/m-p/1049296#M71081</link>
      <description>&lt;P&gt;Hi Folks,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a requirement to download the files of Windchill objects into Thingworx repository. I am getting the Link of files inside Thingworx using Odata Connectors. I am able to generate the file in Repository but when I try to open the file getting error "&lt;SPAN&gt;Failed to load PDF document.&lt;/SPAN&gt;"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Below is the code I am using :&lt;/P&gt;&lt;DIV&gt;// result: JSON&lt;/DIV&gt;&lt;DIV&gt;let inputJson = Things["ptc-windchill-integration-connector"].downloadAsZip({&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;respondWithZip: false /* BOOLEAN {"dataShape":""} */,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;$expand: undefined /* STRING {"dataShape":""} */,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; objectId: &amp;lt;objectId&amp;gt;&lt;/DIV&gt;&lt;DIV&gt;});&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;// result: JSON&lt;/DIV&gt;&lt;DIV&gt;let csrf = Things["Thing.ODataConnector.ProdMgmt_TH"].GetCSRFToken({&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;$select: undefined /* STRING {"dataShape":""} */&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;});&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; item = inputJson.items[0];&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;let params = {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;url: &amp;lt;file_url&amp;gt; /* STRING */ ,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;headers: {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;"CSRF_NONCE": &amp;lt;Nonce token&amp;gt;,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "Accept": "*/*",&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "X-Requested-With": "XMLHttpRequest"&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; };&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;// result: BLOB&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;let binaryContent = Resources["ContentLoaderFunctions"].LoadBinary(params);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; result = binaryContent;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; let fullPath = "/test4/" + item.name;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; Things["SupportRepository"].SaveBinary({&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;path: fullPath /* STRING */,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;content: binaryContent /* BLOB */&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;});&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;What is wrong in my code to authenticate it while downloading it in Thingworx Repository.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Thanks in advance.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Regards,&lt;/DIV&gt;&lt;DIV&gt;VV&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;</description>
      <pubDate>Mon, 29 Dec 2025 06:37:37 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/ThingWorx-Developers/How-to-Authenticate-the-API-for-Windchill-Odata-connector-in/m-p/1049296#M71081</guid>
      <dc:creator>VV_14105315</dc:creator>
      <dc:date>2025-12-29T06:37:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to Authenticate the API for Windchill Odata connector in Thingworx when using SSO Authentica</title>
      <link>https://www.ptcusercommunity.com/t5/ThingWorx-Developers/How-to-Authenticate-the-API-for-Windchill-Odata-connector-in/m-p/1049960#M71096</link>
      <description>&lt;P&gt;Hello VV,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You should be getting the&amp;nbsp;&lt;SPAN&gt;CSRF_NONCE token first and then pass it to subsequent calls - see example bellow:&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;let ParamA = {            
    url: Windchill_URL + "/servlet/odata/v3/PTC/GetCSRFToken()",
    ...
};    
const NONCE_VALUE = Resources["ContentLoaderFunctions"].GetJSON(ParamA);
...
let ParamB = {            
    ...
    headers: {
        ...
        CSRF_NONCE: NONCE_VALUE
    }
};
result = Resources["ContentLoaderFunctions"].PostJSON(ParamB);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;If you still get some error it would be helpful if you provide ThingWorx/WC log snippets.&lt;/P&gt;</description>
      <pubDate>Tue, 06 Jan 2026 14:00:21 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/ThingWorx-Developers/How-to-Authenticate-the-API-for-Windchill-Odata-connector-in/m-p/1049960#M71096</guid>
      <dc:creator>MarekP.Nowaczyk</dc:creator>
      <dc:date>2026-01-06T14:00:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to Authenticate the API for Windchill Odata connector in Thingworx when using SSO Authent...</title>
      <link>https://www.ptcusercommunity.com/t5/ThingWorx-Developers/How-to-Authenticate-the-API-for-Windchill-Odata-connector-in/m-p/1050886#M71122</link>
      <description>&lt;P&gt;Hi &lt;SPAN style="background: var(--ck-color-mention-background); color: var(--ck-color-mention-text);"&gt;&lt;a href="https://www.ptcusercommunity.com/t5/user/viewprofilepage/user-id/996946"&gt;@VV_14105315&lt;/a&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Was the response you received helpful? &amp;nbsp;If you still have questions, please let us know. &amp;nbsp;Otherwise, please mark the response as the Accepted Solution for the benefit of others in the community.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;--Sharon&lt;/P&gt;</description>
      <pubDate>Wed, 14 Jan 2026 16:58:53 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/ThingWorx-Developers/How-to-Authenticate-the-API-for-Windchill-Odata-connector-in/m-p/1050886#M71122</guid>
      <dc:creator>slangley</dc:creator>
      <dc:date>2026-01-14T16:58:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to Authenticate the API for Windchill Odata connector in Thingworx when using SSO Authentica</title>
      <link>https://www.ptcusercommunity.com/t5/ThingWorx-Developers/How-to-Authenticate-the-API-for-Windchill-Odata-connector-in/m-p/1051881#M71147</link>
      <description>&lt;P&gt;Yes Using the Nonce token I fetch the objects then bearer token I download the file in repository. Thank you so much.&lt;/P&gt;</description>
      <pubDate>Thu, 22 Jan 2026 04:49:34 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/ThingWorx-Developers/How-to-Authenticate-the-API-for-Windchill-Odata-connector-in/m-p/1051881#M71147</guid>
      <dc:creator>VV_14105315</dc:creator>
      <dc:date>2026-01-22T04:49:34Z</dc:date>
    </item>
  </channel>
</rss>

