<?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 Using Basic Authentification to get a Bearer token in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Using-Basic-Authentification-to-get-a-Bearer-token/m-p/890650#M43543</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As mentionned in this paper :&amp;nbsp;&lt;A href="https://support.sas.com/resources/papers/proceedings19/3232-2019.pdf" target="_blank"&gt;https://support.sas.com/resources/papers/proceedings19/3232-2019.pdf&lt;/A&gt;&lt;BR /&gt;BASIC authentication is (as the name suggests) very basic. The user name and password&lt;BR /&gt;are sent in an Authorization header encoded in Base64. For all intents and purposes, this&lt;BR /&gt;means that the password is being sent across the wire in clear text. BASIC authentication is&lt;BR /&gt;not secure unless HTTPS is being used.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am using the a base64 encoder (&lt;A href="https://www.base64encode.net/" target="_blank"&gt;https://www.base64encode.net/&lt;/A&gt;) to get a basic encoded credential key&lt;/P&gt;
&lt;P&gt;by passing first the client_id : Client secret.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;From that point, I would like to execute a Proc Http to get a bearer token, but I still getting a 400 error, i.e. bad request.&lt;/P&gt;
&lt;P&gt;Here's my SAS code.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options set=SSLREQCERT="allow";
filename resp temp;
proc http url="https://ca1.qualtrics.com/API/oauth2/token/" 
method="POST" 
auth_basic
in="{""grant_type"":""client_credentials"",
			""scope"":""read:survey_responses""}"
out=resp;
headers "Content-Type"="application/json"
	    "Authorization"="Basic MmFhMDhjNDZiMTBi...";
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Please note that the key value after&amp;nbsp;&lt;CODE class=" language-sas"&gt;"Authorization"="Basic &lt;/CODE&gt; have been cut for safety purpose.&lt;/P&gt;
&lt;P&gt;Could it be possible to help me with that SAS code&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 23 Aug 2023 19:52:12 GMT</pubDate>
    <dc:creator>alepage</dc:creator>
    <dc:date>2023-08-23T19:52:12Z</dc:date>
    <item>
      <title>Using Basic Authentification to get a Bearer token</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Using-Basic-Authentification-to-get-a-Bearer-token/m-p/890650#M43543</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As mentionned in this paper :&amp;nbsp;&lt;A href="https://support.sas.com/resources/papers/proceedings19/3232-2019.pdf" target="_blank"&gt;https://support.sas.com/resources/papers/proceedings19/3232-2019.pdf&lt;/A&gt;&lt;BR /&gt;BASIC authentication is (as the name suggests) very basic. The user name and password&lt;BR /&gt;are sent in an Authorization header encoded in Base64. For all intents and purposes, this&lt;BR /&gt;means that the password is being sent across the wire in clear text. BASIC authentication is&lt;BR /&gt;not secure unless HTTPS is being used.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am using the a base64 encoder (&lt;A href="https://www.base64encode.net/" target="_blank"&gt;https://www.base64encode.net/&lt;/A&gt;) to get a basic encoded credential key&lt;/P&gt;
&lt;P&gt;by passing first the client_id : Client secret.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;From that point, I would like to execute a Proc Http to get a bearer token, but I still getting a 400 error, i.e. bad request.&lt;/P&gt;
&lt;P&gt;Here's my SAS code.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options set=SSLREQCERT="allow";
filename resp temp;
proc http url="https://ca1.qualtrics.com/API/oauth2/token/" 
method="POST" 
auth_basic
in="{""grant_type"":""client_credentials"",
			""scope"":""read:survey_responses""}"
out=resp;
headers "Content-Type"="application/json"
	    "Authorization"="Basic MmFhMDhjNDZiMTBi...";
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Please note that the key value after&amp;nbsp;&lt;CODE class=" language-sas"&gt;"Authorization"="Basic &lt;/CODE&gt; have been cut for safety purpose.&lt;/P&gt;
&lt;P&gt;Could it be possible to help me with that SAS code&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 23 Aug 2023 19:52:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Using-Basic-Authentification-to-get-a-Bearer-token/m-p/890650#M43543</guid>
      <dc:creator>alepage</dc:creator>
      <dc:date>2023-08-23T19:52:12Z</dc:date>
    </item>
    <item>
      <title>Re: Using Basic Authentification to get a Bearer token</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Using-Basic-Authentification-to-get-a-Bearer-token/m-p/891303#M43562</link>
      <description>&lt;P&gt;Have you tried the answer posted here?&lt;BR /&gt;&lt;A href="https://communities.sas.com/t5/SAS-Programming/How-to-use-PROC-HTTP-with-OAUTH-to-get-an-access-token-from-a/td-p/778490" target="_blank"&gt;Solved: How to use PROC HTTP with OAUTH to get an access token from a remote s... - SAS Support Communities&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Aug 2023 12:26:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Using-Basic-Authentification-to-get-a-Bearer-token/m-p/891303#M43562</guid>
      <dc:creator>SASJedi</dc:creator>
      <dc:date>2023-08-28T12:26:33Z</dc:date>
    </item>
  </channel>
</rss>

