<?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 HTTP basic authentication method in Survey123 javascript in ArcGIS Survey123 Questions</title>
    <link>https://community.esri.com/t5/arcgis-survey123-questions/http-basic-authentication-method-in-survey123/m-p/1241970#M46580</link>
    <description>&lt;P&gt;Hi, From a Survey123 Javascript, I would like to call an API with the HTTP basic authentication method. This is the requirement from the API supplier:&lt;/P&gt;&lt;P&gt;Authentication&lt;BR /&gt;Each request requires authentication, which is performed using the HTTP basic authentication method. The header contains the authentication data in the form "Basic username:password" where the phrase "username:password" is Base64 encoded. Username and password are set individually for each external system.&lt;/P&gt;&lt;P&gt;I have tried with:&lt;BR /&gt;var url = `&amp;lt;MyUser&amp;gt;:&amp;lt;myPassword&amp;gt;@branchekataloget.dk/api-gateway/Branchekataloget/products?${parameters}`&lt;/P&gt;&lt;P&gt;xmlhttp.open("GET",url,false);&lt;BR /&gt;xmlhttp.send();&lt;/P&gt;&lt;P&gt;But get the answer:&lt;BR /&gt;Error in &amp;lt;MyScript&amp;gt;.js : 28:1 Expected token `;'&lt;/P&gt;&lt;P&gt;Hope you can point me in the right direction &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 16 Dec 2022 14:23:31 GMT</pubDate>
    <dc:creator>MartinBrandi</dc:creator>
    <dc:date>2022-12-16T14:23:31Z</dc:date>
    <item>
      <title>HTTP basic authentication method in Survey123 javascript</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/http-basic-authentication-method-in-survey123/m-p/1241970#M46580</link>
      <description>&lt;P&gt;Hi, From a Survey123 Javascript, I would like to call an API with the HTTP basic authentication method. This is the requirement from the API supplier:&lt;/P&gt;&lt;P&gt;Authentication&lt;BR /&gt;Each request requires authentication, which is performed using the HTTP basic authentication method. The header contains the authentication data in the form "Basic username:password" where the phrase "username:password" is Base64 encoded. Username and password are set individually for each external system.&lt;/P&gt;&lt;P&gt;I have tried with:&lt;BR /&gt;var url = `&amp;lt;MyUser&amp;gt;:&amp;lt;myPassword&amp;gt;@branchekataloget.dk/api-gateway/Branchekataloget/products?${parameters}`&lt;/P&gt;&lt;P&gt;xmlhttp.open("GET",url,false);&lt;BR /&gt;xmlhttp.send();&lt;/P&gt;&lt;P&gt;But get the answer:&lt;BR /&gt;Error in &amp;lt;MyScript&amp;gt;.js : 28:1 Expected token `;'&lt;/P&gt;&lt;P&gt;Hope you can point me in the right direction &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Dec 2022 14:23:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/http-basic-authentication-method-in-survey123/m-p/1241970#M46580</guid>
      <dc:creator>MartinBrandi</dc:creator>
      <dc:date>2022-12-16T14:23:31Z</dc:date>
    </item>
    <item>
      <title>Re: HTTP basic authentication method in Survey123 javascript</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/http-basic-authentication-method-in-survey123/m-p/1242201#M46585</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/260024"&gt;@MartinBrandi&lt;/a&gt;,&amp;nbsp;&lt;/P&gt;&lt;P&gt;The expected token error likely indicates that a semicolon is missing from line 28 of the JavaScript function. If there is a semicolon there and the error seems like a red herring I&amp;nbsp;would suggest using a tool called &lt;A href="https://www.postman.com/" target="_self"&gt;Postman&lt;/A&gt;&amp;nbsp;to set up the http request. Once it's working in Postman there is a neat tool that lets you copy a code snippet of the request in JavaScript XHR format.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 17 Dec 2022 01:05:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/http-basic-authentication-method-in-survey123/m-p/1242201#M46585</guid>
      <dc:creator>ZacharySutherby</dc:creator>
      <dc:date>2022-12-17T01:05:14Z</dc:date>
    </item>
    <item>
      <title>Re: HTTP basic authentication method in Survey123 javascript</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/http-basic-authentication-method-in-survey123/m-p/1242365#M46592</link>
      <description>&lt;P&gt;Hi Zach&lt;/P&gt;&lt;P&gt;Thank you very much for your help, Postman was a great help&lt;/P&gt;&lt;P&gt;This code works. I hope others can benefit from this:&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;function Myfunction() {&lt;/P&gt;&lt;P&gt;var xhr = new XMLHttpRequest();&lt;BR /&gt;xhr.withCredentials = true;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;xhr.open("GET", "My URL",null);&lt;/P&gt;&lt;P&gt;xhr.setRequestHeader("Authorization", "Basic&amp;nbsp; &amp;lt;username:password as Base64 encoded&amp;gt; ");&lt;BR /&gt;xhr.setRequestHeader("Cookie", "PHPSESSID=ba4jnakh2u0r5l0mgpsndgggul");&lt;/P&gt;&lt;P&gt;xhr.send();&lt;BR /&gt;var responseJSON=JSON.parse(xhr.responseText)&lt;BR /&gt;return JSON.stringify(responseJSON);&lt;BR /&gt;}&lt;/P&gt;</description>
      <pubDate>Mon, 19 Dec 2022 15:11:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/http-basic-authentication-method-in-survey123/m-p/1242365#M46592</guid>
      <dc:creator>MartinBrandi</dc:creator>
      <dc:date>2022-12-19T15:11:31Z</dc:date>
    </item>
    <item>
      <title>Re: HTTP basic authentication method in Survey123 javascript</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/http-basic-authentication-method-in-survey123/m-p/1331376#M51903</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/260024"&gt;@MartinBrandi&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;SPAN&gt;Do you know how to do basic authentication using Microsoft Power Automate - HTTP Action?&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;SPAN&gt;&lt;A href="https://community.esri.com/t5/arcgis-survey123-questions/survey123-power-automate-how-to-generate-quot/m-p/1331361" target="_blank" rel="noopener"&gt;Survey123 Power Automate - How to generate "Token"... - Esri Community&lt;/A&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;SPAN&gt;Reno&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 22 Sep 2023 09:15:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/http-basic-authentication-method-in-survey123/m-p/1331376#M51903</guid>
      <dc:creator>rsun_TQB</dc:creator>
      <dc:date>2023-09-22T09:15:56Z</dc:date>
    </item>
    <item>
      <title>Re: HTTP basic authentication method in Survey123 javascript</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/http-basic-authentication-method-in-survey123/m-p/1357515#M53264</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/260024"&gt;@MartinBrandi&lt;/a&gt;&amp;nbsp;- How were you able to do the base64 encoding for the username and password in Survey123 Connect? I have a very similar system to what you're using but the bota() and atob() methods don't seem to work in Survey123. Any suggestions?&lt;/P&gt;</description>
      <pubDate>Wed, 06 Dec 2023 18:02:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/http-basic-authentication-method-in-survey123/m-p/1357515#M53264</guid>
      <dc:creator>DerekKonofalski</dc:creator>
      <dc:date>2023-12-06T18:02:40Z</dc:date>
    </item>
    <item>
      <title>Re: HTTP basic authentication method in Survey123 javascript</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/http-basic-authentication-method-in-survey123/m-p/1357522#M53267</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/260024"&gt;@MartinBrandi&lt;/a&gt;&amp;nbsp;- Not sure if you meant to mark my response as the solution to this since it was a question. Any insight you can provide would be helpful.&lt;/P&gt;</description>
      <pubDate>Wed, 06 Dec 2023 18:08:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/http-basic-authentication-method-in-survey123/m-p/1357522#M53267</guid>
      <dc:creator>DerekKonofalski</dc:creator>
      <dc:date>2023-12-06T18:08:37Z</dc:date>
    </item>
    <item>
      <title>Re: HTTP basic authentication method in Survey123 javascript</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/http-basic-authentication-method-in-survey123/m-p/1357527#M53268</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/260024"&gt;@MartinBrandi&lt;/a&gt;&amp;nbsp;- Are you doing that intentionally? My response is not a solution to your question. &amp;nbsp;&lt;span class="lia-unicode-emoji" title=":confused_face:"&gt;😕&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Dec 2023 18:16:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/http-basic-authentication-method-in-survey123/m-p/1357527#M53268</guid>
      <dc:creator>DerekKonofalski</dc:creator>
      <dc:date>2023-12-06T18:16:30Z</dc:date>
    </item>
    <item>
      <title>Re: HTTP basic authentication method in Survey123 javascript</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/http-basic-authentication-method-in-survey123/m-p/1357532#M53269</link>
      <description>&lt;P&gt;Are you a bot,&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/260024"&gt;@MartinBrandi&lt;/a&gt;?&lt;/P&gt;</description>
      <pubDate>Wed, 06 Dec 2023 18:18:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/http-basic-authentication-method-in-survey123/m-p/1357532#M53269</guid>
      <dc:creator>DerekKonofalski</dc:creator>
      <dc:date>2023-12-06T18:18:56Z</dc:date>
    </item>
    <item>
      <title>Re: HTTP basic authentication method in Survey123 javascript</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/http-basic-authentication-method-in-survey123/m-p/1357534#M53270</link>
      <description>&lt;P&gt;Seems like&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/260024"&gt;@MartinBrandi&lt;/a&gt;&amp;nbsp;is just a bot that auto-accepts all responses as solutions and gives them kudos.&lt;/P&gt;</description>
      <pubDate>Wed, 06 Dec 2023 18:21:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/http-basic-authentication-method-in-survey123/m-p/1357534#M53270</guid>
      <dc:creator>DerekKonofalski</dc:creator>
      <dc:date>2023-12-06T18:21:00Z</dc:date>
    </item>
    <item>
      <title>Re: HTTP basic authentication method in Survey123 javascript</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/http-basic-authentication-method-in-survey123/m-p/1357541#M53271</link>
      <description>&lt;P&gt;Thanks for the expert badge,&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/260024"&gt;@MartinBrandi&lt;/a&gt;. &lt;span class="lia-unicode-emoji" title=":face_with_rolling_eyes:"&gt;🙄&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Dec 2023 18:25:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/http-basic-authentication-method-in-survey123/m-p/1357541#M53271</guid>
      <dc:creator>DerekKonofalski</dc:creator>
      <dc:date>2023-12-06T18:25:23Z</dc:date>
    </item>
    <item>
      <title>Re: HTTP basic authentication method in Survey123 javascript</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/http-basic-authentication-method-in-survey123/m-p/1357561#M53272</link>
      <description>&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;SPAN&gt;Hi&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class=""&gt;&lt;A href="https://community.esri.com/t5/user/viewprofilepage/user-id/168045" target="_self"&gt;&lt;SPAN class=""&gt;Derek&lt;/SPAN&gt;&lt;/A&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;No don't know what is going on with the checkmarks??&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;I am not a programmer so bear with me. I just did what&amp;nbsp;&lt;SPAN&gt;Zach suggested and used Postman to setup the&amp;nbsp;HTTP basic authentication method&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="MartinBrandi_0-1701887289436.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/88187i585A9B3B2C79D518/image-size/medium?v=v2&amp;amp;px=400" role="button" title="MartinBrandi_0-1701887289436.png" alt="MartinBrandi_0-1701887289436.png" /&gt;&lt;/span&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And then copyed the code from Postman to the Script in Survey123:&amp;nbsp;&lt;/P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="MartinBrandi_1-1701887486537.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/88188i4EAD5C7F0C2A0945/image-size/medium?v=v2&amp;amp;px=400" role="button" title="MartinBrandi_1-1701887486537.png" alt="MartinBrandi_1-1701887486537.png" /&gt;&lt;/span&gt;&lt;P&gt;Don't know if this was any help at all.&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Martin&amp;nbsp;&lt;/P&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 06 Dec 2023 18:41:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/http-basic-authentication-method-in-survey123/m-p/1357561#M53272</guid>
      <dc:creator>MartinBrandi</dc:creator>
      <dc:date>2023-12-06T18:41:50Z</dc:date>
    </item>
    <item>
      <title>Re: HTTP basic authentication method in Survey123 javascript</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/http-basic-authentication-method-in-survey123/m-p/1357571#M53274</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/260024"&gt;@MartinBrandi&lt;/a&gt;&amp;nbsp;- Sorry about all the comments, then. Wasn't sure why they were getting immediately checked and marked as the solution either.&lt;/P&gt;&lt;P&gt;Understood that you're not a programmer. Do you know how you've set up the username and password in that in order to not expose it publicly? The part that I'm most concerned with is the part that's cut off in your screenshot.&lt;/P&gt;</description>
      <pubDate>Wed, 06 Dec 2023 18:53:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/http-basic-authentication-method-in-survey123/m-p/1357571#M53274</guid>
      <dc:creator>DerekKonofalski</dc:creator>
      <dc:date>2023-12-06T18:53:26Z</dc:date>
    </item>
  </channel>
</rss>

