<?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 Re: proc http Authorization error in batch mode in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/proc-http-Authorization-error-in-batch-mode/m-p/938906#M368745</link>
    <description>Look how is the batch job is scheduled. &lt;BR /&gt;&lt;BR /&gt;You can write &amp;amp;sysuserid to the log to see what user is used.</description>
    <pubDate>Sun, 11 Aug 2024 10:14:25 GMT</pubDate>
    <dc:creator>ChrisNZ</dc:creator>
    <dc:date>2024-08-11T10:14:25Z</dc:date>
    <item>
      <title>proc http Authorization error in batch mode</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-http-Authorization-error-in-batch-mode/m-p/938903#M368742</link>
      <description>&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp;I'm trying to get a list of the file names in a directory (&amp;amp;path) from azure. The following code works well in an interactive SAS session but encountering a "400 Bad Request" error in batch mode.&amp;nbsp;&lt;BR /&gt;In the output.xml file, I get this message: &amp;lt;?xml version="1.0" encoding="utf-8"?&amp;gt;&amp;lt;Error&amp;gt;&amp;lt;Code&amp;gt;InvalidAuthenticationInfo&amp;lt;/Code&amp;gt;&amp;lt;Message&amp;gt;Authentication information is not given in the correct format. Check the value of Authorization header.&lt;BR /&gt;Why the azure_token is not working in the batch mode? Can someone please give some possible solutions?&lt;BR /&gt;&lt;BR /&gt;Here is the code:&lt;BR /&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;filename&lt;/SPAN&gt;&lt;SPAN&gt; json_in &lt;/SPAN&gt;&lt;SPAN&gt;temp&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;data&lt;/SPAN&gt; &lt;SPAN&gt;_null_&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;file&lt;/SPAN&gt;&lt;SPAN&gt; in&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;run&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;filename&lt;/SPAN&gt;&lt;SPAN&gt; resp &lt;/SPAN&gt;&lt;SPAN&gt;"X:\output.xml"&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;proc&lt;/SPAN&gt; &lt;SPAN&gt;http&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;method&lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;SPAN&gt;"GET"&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;url&lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt; &lt;SPAN&gt;"&amp;amp;pathx.?restype=directory&amp;amp;include=timestamps&amp;amp;comp=list"&lt;/SPAN&gt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&amp;amp;azure_token."&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;run&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 11 Aug 2024 08:04:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-http-Authorization-error-in-batch-mode/m-p/938903#M368742</guid>
      <dc:creator>KK-321</dc:creator>
      <dc:date>2024-08-11T08:04:33Z</dc:date>
    </item>
    <item>
      <title>Re: proc http Authorization error in batch mode</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-http-Authorization-error-in-batch-mode/m-p/938904#M368743</link>
      <description>&lt;P&gt;I suspect the batch job runs under a different userid that can't access Azure.&lt;/P&gt;</description>
      <pubDate>Sun, 11 Aug 2024 09:26:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-http-Authorization-error-in-batch-mode/m-p/938904#M368743</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2024-08-11T09:26:19Z</dc:date>
    </item>
    <item>
      <title>Re: proc http Authorization error in batch mode</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-http-Authorization-error-in-batch-mode/m-p/938905#M368744</link>
      <description>&lt;P&gt;The SAS session and batch are run on the same machine. Is it possible they are under different user ids? Do you know where and how can I find this id?&lt;/P&gt;</description>
      <pubDate>Sun, 11 Aug 2024 10:04:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-http-Authorization-error-in-batch-mode/m-p/938905#M368744</guid>
      <dc:creator>KK-321</dc:creator>
      <dc:date>2024-08-11T10:04:01Z</dc:date>
    </item>
    <item>
      <title>Re: proc http Authorization error in batch mode</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-http-Authorization-error-in-batch-mode/m-p/938906#M368745</link>
      <description>Look how is the batch job is scheduled. &lt;BR /&gt;&lt;BR /&gt;You can write &amp;amp;sysuserid to the log to see what user is used.</description>
      <pubDate>Sun, 11 Aug 2024 10:14:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-http-Authorization-error-in-batch-mode/m-p/938906#M368745</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2024-08-11T10:14:25Z</dc:date>
    </item>
    <item>
      <title>Re: proc http Authorization error in batch mode</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-http-Authorization-error-in-batch-mode/m-p/938908#M368746</link>
      <description>&lt;P&gt;Add&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%put xxx&amp;amp;azure_token.xxx;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;to your code and inspect/compare the logs.&lt;/P&gt;</description>
      <pubDate>Sun, 11 Aug 2024 12:33:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-http-Authorization-error-in-batch-mode/m-p/938908#M368746</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2024-08-11T12:33:42Z</dc:date>
    </item>
    <item>
      <title>Re: proc http Authorization error in batch mode</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-http-Authorization-error-in-batch-mode/m-p/938917#M368747</link>
      <description>&lt;P&gt;In SAS session, the token looks ok, but in batch mode, the macro is not resolved because of 400 bad request. The log shows xxxxxx.&lt;/P&gt;</description>
      <pubDate>Mon, 12 Aug 2024 00:01:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-http-Authorization-error-in-batch-mode/m-p/938917#M368747</guid>
      <dc:creator>KK-321</dc:creator>
      <dc:date>2024-08-12T00:01:53Z</dc:date>
    </item>
    <item>
      <title>Re: proc http Authorization error in batch mode</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-http-Authorization-error-in-batch-mode/m-p/938925#M368748</link>
      <description>&lt;P&gt;The fact that it is not resolved is the cause for the 400 error. Look where the macro variable is defined in your interactive session.&lt;/P&gt;</description>
      <pubDate>Mon, 12 Aug 2024 05:34:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-http-Authorization-error-in-batch-mode/m-p/938925#M368748</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2024-08-12T05:34:51Z</dc:date>
    </item>
    <item>
      <title>Re: proc http Authorization error in batch mode</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-http-Authorization-error-in-batch-mode/m-p/938976#M368752</link>
      <description>&lt;P&gt;I don't see a variable &amp;amp;path. I do see &amp;amp;pathx&lt;/P&gt;
&lt;PRE&gt; url= "&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;&amp;amp;pathx&lt;/STRONG&gt;&lt;/FONT&gt;.?restype=directory&amp;amp;include=timestamps&amp;amp;comp=list"&lt;/PRE&gt;
&lt;P&gt;I also do not see where &amp;amp;path or &amp;amp;pathx is set. So without that bit of info I would say that is the likely problem: the macro variable with the path is not assigned, or assigned incorrectly in batch mode.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Where is the LOG created when you run this? I see several things that SAS might complain about as undefined macro variables that are URL elements.&lt;/P&gt;</description>
      <pubDate>Mon, 12 Aug 2024 14:42:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-http-Authorization-error-in-batch-mode/m-p/938976#M368752</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2024-08-12T14:42:23Z</dc:date>
    </item>
  </channel>
</rss>

