<?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: Postman Pre-Request Authorization Script to access SAS VIYA APIs in Developers</title>
    <link>https://communities.sas.com/t5/Developers/Postman-Pre-Request-Authorization-Script-to-access-SAS-VIYA-APIs/m-p/655640#M820</link>
    <description>&lt;P&gt;Hi Allan,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;There is one final thing as follow:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am able to a get an access token anytime using this command on shell&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;curl -k -X POST "https://aeadsaswf01-afs.adfca.ae/SASLogon/oauth/token" \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "grant_type=password&amp;amp;username=wael.k.aburizq&amp;amp;password=Password1" \
-u "mysasclient:Mysecret"&lt;/PRE&gt;&lt;P&gt;However, this postman pre-request script is not working knowing that "bXlzYXNjbGllbnQ6TXlzZWNyZXQ=" is coming from&amp;nbsp;&lt;A href="https://www.blitter.se/utils/basic-authentication-header-generator/" target="_self"&gt;basic-authentication-header-generator&lt;/A&gt;&amp;nbsp; for the above client_id and secret in the "u"&lt;/P&gt;&lt;PRE&gt;pm.sendRequest({
    url: "https://aeadsaswf01-afs.adfca.ae/SASLogon/oauth/token",
    method: 'POST',
    header: {
        'Authorization': 'Basic '+ "bXlzYXNjbGllbnQ6TXlzZWNyZXQ=",
        'Accept': 'application/json',
        'Content-Type': 'application/x-www-form-urlencoded',
    },
    body: {
          mode: 'urlencoded',
          urlencoded: [
            {key: "grant_type", value: "password", disabled: false},
            {key: "username", value: pm.environment.get("OAUTH_USERNAME"), disabled: false},
            {key: "password", value: pm.environment.get("OAUTH_PASSWORD"), disabled: false}
        ]
    }
  }, function (err, res) {
        pm.environment.set("authToken", res.json().access_token);
});&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The error is:&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;&lt;SPAN&gt;There was an error in evaluating the Pre-request Script: &amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="prscript-error-message"&gt;Error: Unexpected token u in JSON at position 0&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 09 Jun 2020 21:29:43 GMT</pubDate>
    <dc:creator>WaelAburezeq</dc:creator>
    <dc:date>2020-06-09T21:29:43Z</dc:date>
    <item>
      <title>Postman Pre-Request Authorization Script to access SAS VIYA APIs</title>
      <link>https://communities.sas.com/t5/Developers/Postman-Pre-Request-Authorization-Script-to-access-SAS-VIYA-APIs/m-p/654426#M816</link>
      <description>&lt;P&gt;Hi folks,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am referring to a Webinar published on 6th of May titled "&lt;SPAN&gt;Using&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="il"&gt;SAS&lt;/SPAN&gt;&lt;SPAN&gt;®&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="il"&gt;APIs" at this URL:&amp;nbsp;&lt;A href="https://www.sas.com/en_us/webinars/using-sas-apis.html" target="_blank"&gt;https://www.sas.com/en_us/webinars/using-sas-apis.html&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I downloaded the PostMan json file and imported it, I am much concerned about Create CAS Session --&amp;gt; Pre-request Scripts. What do these three variables , in the following script, refer to:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Variable #1:&amp;nbsp;&lt;SPAN&gt;"token_url": Is this the URL used to access SAS? or the Client.Token?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Variable #2: "&lt;SPAN&gt;encoded_id_secret" Is this the client.token, client_id, client_secret; or What???&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Variable #3: "OAUTH_USERNAME" Is this the LDAP username that already have access to SAS VIYA?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;PRE&gt;pm.sendRequest({
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;url:&amp;nbsp;pm.environment.get("&lt;FONT color="#FF0000"&gt;token_url&lt;/FONT&gt;")+"/SASLogon/oauth/token",
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;method:&amp;nbsp;'POST',
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;header:&amp;nbsp;{
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;'Authorization':&amp;nbsp;'Basic&amp;nbsp;'+&amp;nbsp;pm.environment.get("&lt;FONT color="#FF0000"&gt;encoded_id_secret&lt;/FONT&gt;"),
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;'Accept':&amp;nbsp;'application/json',
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;'Content-Type':&amp;nbsp;'application/x-www-form-urlencoded',
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;},
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;body:&amp;nbsp;{
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;mode:&amp;nbsp;'urlencoded',
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;urlencoded:&amp;nbsp;[
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{key:&amp;nbsp;"grant_type",&amp;nbsp;value:&amp;nbsp;"password",&amp;nbsp;disabled:&amp;nbsp;false},
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{key:&amp;nbsp;"username",&amp;nbsp;value:&amp;nbsp;pm.environment.get("OAUTH_USERNAME"),&amp;nbsp;disabled:&amp;nbsp;false},
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{key:&amp;nbsp;"password",&amp;nbsp;value:&amp;nbsp;pm.environment.get("OAUTH_PASSWORD"),&amp;nbsp;disabled:&amp;nbsp;false}
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}
&amp;nbsp;&amp;nbsp;},&amp;nbsp;function&amp;nbsp;(err,&amp;nbsp;res)&amp;nbsp;{
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;pm.environment.set("authToken",&amp;nbsp;res.json().access_token);
});&lt;/PRE&gt;&lt;P&gt;Thank you,&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>Mon, 08 Jun 2020 09:34:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/Postman-Pre-Request-Authorization-Script-to-access-SAS-VIYA-APIs/m-p/654426#M816</guid>
      <dc:creator>WaelAburezeq</dc:creator>
      <dc:date>2020-06-08T09:34:38Z</dc:date>
    </item>
    <item>
      <title>Re: Postman Pre-Request Authorization Script to access SAS VIYA APIs</title>
      <link>https://communities.sas.com/t5/Developers/Postman-Pre-Request-Authorization-Script-to-access-SAS-VIYA-APIs/m-p/654441#M817</link>
      <description>&lt;P&gt;Variable 1 (token_url) -&amp;gt; this is simply the url of your SAS Viya Server.&amp;nbsp; If you are running directly on Viya, this would / could be "localhost.&amp;nbsp; Postman just needs to be able to find "/SASLogon" here.&lt;BR /&gt;&lt;BR /&gt;Variable 2 (encoded_id_secret) - this is the base64 encoded output from "${CLIENT_ID}:${CLIENT_SECRET}"&amp;nbsp; (Basic Authentication).&amp;nbsp; So, client_id + ":" + client_secret, base64 encoded.&amp;nbsp; There are online generators to help you create this, eg:&amp;nbsp;&amp;nbsp;&lt;A href="https://www.blitter.se/utils/basic-authentication-header-generator/" target="_blank"&gt;https://www.blitter.se/utils/basic-authentication-header-generator/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Variable 3 (OAUTH username / password) - this is the regular username / password you use to log into Viya.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope this helps.&amp;nbsp; By the way, this approach (with embedded username / password) is known as "implicit" flow.&amp;nbsp; The alternative (&lt;SPAN&gt;authorization_code)&amp;nbsp;&lt;/SPAN&gt; is quite similar - this article may help:&amp;nbsp;&lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/Token-Management-in-HTML5-Viya-Apps/ta-p/652388" target="_blank"&gt;https://communities.sas.com/t5/SAS-Communities-Library/Token-Management-in-HTML5-Viya-Apps/ta-p/652388&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 08 Jun 2020 09:50:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/Postman-Pre-Request-Authorization-Script-to-access-SAS-VIYA-APIs/m-p/654441#M817</guid>
      <dc:creator>AllanBowe</dc:creator>
      <dc:date>2020-06-08T09:50:44Z</dc:date>
    </item>
    <item>
      <title>Re: Postman Pre-Request Authorization Script to access SAS VIYA APIs</title>
      <link>https://communities.sas.com/t5/Developers/Postman-Pre-Request-Authorization-Script-to-access-SAS-VIYA-APIs/m-p/654447#M818</link>
      <description>&lt;P&gt;Thank you Allan for your prompt response, it is highly appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;One more clarification,&amp;nbsp;&lt;SPAN&gt;I already registered the client and assigned a client secret using this script: &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;curl -X POST "https://localhost/SASLogon/oauth/clients" \ &lt;BR /&gt;      -H "Content-Type: application/json" \ &lt;BR /&gt;      -H "Authorization: Bearer $access_token" \ &lt;BR /&gt;       -d '{ "client_id": "app", "client_secret": "cs123secret", "scope": ["openid"], "authorized_grant_types": ["password"], "access_token_validity": 43199 }'&lt;/PRE&gt;&lt;P&gt;$access_token is coming from a script executed based on client.token file in SAS server.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;My question is with regards to the variable &lt;/SPAN&gt;&lt;A href="https://www.linkedin.com/feed/hashtag/?keywords=%232" target="_blank" rel="noopener"&gt;#2&lt;/A&gt;&lt;SPAN&gt;:&amp;nbsp;encoded_id_secret Should I just define it as &lt;FONT color="#FF0000"&gt;app:cs123secret&lt;/FONT&gt;&amp;nbsp; and it will generate the token that I will use the get method later to continue with?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 08 Jun 2020 10:02:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/Postman-Pre-Request-Authorization-Script-to-access-SAS-VIYA-APIs/m-p/654447#M818</guid>
      <dc:creator>WaelAburezeq</dc:creator>
      <dc:date>2020-06-08T10:02:05Z</dc:date>
    </item>
    <item>
      <title>Re: Postman Pre-Request Authorization Script to access SAS VIYA APIs</title>
      <link>https://communities.sas.com/t5/Developers/Postman-Pre-Request-Authorization-Script-to-access-SAS-VIYA-APIs/m-p/654449#M819</link>
      <description>You should take the "app" and "cs123secret" and base64 encode (eg using a site like this -  &lt;A href="https://www.blitter.se/utils/basic-authentication-header-generator/" target="_blank"&gt;https://www.blitter.se/utils/basic-authentication-header-generator/&lt;/A&gt;) and use the result, eg: "YXBwOmNzMTIzc2VjcmV0" in your variable.</description>
      <pubDate>Mon, 08 Jun 2020 10:15:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/Postman-Pre-Request-Authorization-Script-to-access-SAS-VIYA-APIs/m-p/654449#M819</guid>
      <dc:creator>AllanBowe</dc:creator>
      <dc:date>2020-06-08T10:15:47Z</dc:date>
    </item>
    <item>
      <title>Re: Postman Pre-Request Authorization Script to access SAS VIYA APIs</title>
      <link>https://communities.sas.com/t5/Developers/Postman-Pre-Request-Authorization-Script-to-access-SAS-VIYA-APIs/m-p/655640#M820</link>
      <description>&lt;P&gt;Hi Allan,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;There is one final thing as follow:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am able to a get an access token anytime using this command on shell&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;curl -k -X POST "https://aeadsaswf01-afs.adfca.ae/SASLogon/oauth/token" \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "grant_type=password&amp;amp;username=wael.k.aburizq&amp;amp;password=Password1" \
-u "mysasclient:Mysecret"&lt;/PRE&gt;&lt;P&gt;However, this postman pre-request script is not working knowing that "bXlzYXNjbGllbnQ6TXlzZWNyZXQ=" is coming from&amp;nbsp;&lt;A href="https://www.blitter.se/utils/basic-authentication-header-generator/" target="_self"&gt;basic-authentication-header-generator&lt;/A&gt;&amp;nbsp; for the above client_id and secret in the "u"&lt;/P&gt;&lt;PRE&gt;pm.sendRequest({
    url: "https://aeadsaswf01-afs.adfca.ae/SASLogon/oauth/token",
    method: 'POST',
    header: {
        'Authorization': 'Basic '+ "bXlzYXNjbGllbnQ6TXlzZWNyZXQ=",
        'Accept': 'application/json',
        'Content-Type': 'application/x-www-form-urlencoded',
    },
    body: {
          mode: 'urlencoded',
          urlencoded: [
            {key: "grant_type", value: "password", disabled: false},
            {key: "username", value: pm.environment.get("OAUTH_USERNAME"), disabled: false},
            {key: "password", value: pm.environment.get("OAUTH_PASSWORD"), disabled: false}
        ]
    }
  }, function (err, res) {
        pm.environment.set("authToken", res.json().access_token);
});&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The error is:&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;&lt;SPAN&gt;There was an error in evaluating the Pre-request Script: &amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="prscript-error-message"&gt;Error: Unexpected token u in JSON at position 0&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jun 2020 21:29:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/Postman-Pre-Request-Authorization-Script-to-access-SAS-VIYA-APIs/m-p/655640#M820</guid>
      <dc:creator>WaelAburezeq</dc:creator>
      <dc:date>2020-06-09T21:29:43Z</dc:date>
    </item>
    <item>
      <title>Re: Postman Pre-Request Authorization Script to access SAS VIYA APIs</title>
      <link>https://communities.sas.com/t5/Developers/Postman-Pre-Request-Authorization-Script-to-access-SAS-VIYA-APIs/m-p/655647#M821</link>
      <description>&lt;P&gt;Strange.&amp;nbsp; I wonder if there's something preventing implicit flow in your Environment Manager setup.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you have the admin rights, you could get yourself a token using SASStudioV, just step through the following:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/*compile macros from macrocore library (or download and run seperately) */
filename mc url "https://raw.githubusercontent.com/macropeople/macrocore/master/mc_all.sas?_=3";
%inc mc;

/* register new client with random cliend_id &amp;amp; secret */
%mv_registerclient()

/* take the link from the log above, and open it in a browser */
/* then paste the auth code in the macro below and run it */
 %mv_tokenauth(code=LD39EpalOf)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This will give you an access_token and refresh_token suitable for an authorization_code approach as described here:&amp;nbsp;&lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/Token-Management-in-HTML5-Viya-Apps/ta-p/652388" target="_blank"&gt;https://communities.sas.com/t5/SAS-Communities-Library/Token-Management-in-HTML5-Viya-Apps/ta-p/652388&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jun 2020 22:15:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/Postman-Pre-Request-Authorization-Script-to-access-SAS-VIYA-APIs/m-p/655647#M821</guid>
      <dc:creator>AllanBowe</dc:creator>
      <dc:date>2020-06-09T22:15:28Z</dc:date>
    </item>
    <item>
      <title>Re: Postman Pre-Request Authorization Script to access SAS VIYA APIs</title>
      <link>https://communities.sas.com/t5/Developers/Postman-Pre-Request-Authorization-Script-to-access-SAS-VIYA-APIs/m-p/656040#M822</link>
      <description>&lt;P&gt;I see,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but the idea behind is that I will embed a REST API for a ML model into one of the local systems. This API needs an access token before it is executed, so I need to keep passing active tokens in the requests.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hope I was able to make it more clear now&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jun 2020 06:53:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/Postman-Pre-Request-Authorization-Script-to-access-SAS-VIYA-APIs/m-p/656040#M822</guid>
      <dc:creator>WaelAburezeq</dc:creator>
      <dc:date>2020-06-10T06:53:24Z</dc:date>
    </item>
    <item>
      <title>Re: Postman Pre-Request Authorization Script to access SAS VIYA APIs</title>
      <link>https://communities.sas.com/t5/Developers/Postman-Pre-Request-Authorization-Script-to-access-SAS-VIYA-APIs/m-p/656396#M825</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/161470"&gt;@WaelAburezeq&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;Can you provide the results of the "Code" output from Postman and the Postman Console contents for this call?&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jun 2020 12:51:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/Postman-Pre-Request-Authorization-Script-to-access-SAS-VIYA-APIs/m-p/656396#M825</guid>
      <dc:creator>joeFurbee</dc:creator>
      <dc:date>2020-06-10T12:51:48Z</dc:date>
    </item>
    <item>
      <title>Re: Postman Pre-Request Authorization Script to access SAS VIYA APIs</title>
      <link>https://communities.sas.com/t5/Developers/Postman-Pre-Request-Authorization-Script-to-access-SAS-VIYA-APIs/m-p/656423#M826</link>
      <description>&lt;P&gt;This is the result from Postman, I just want to highlights some points:&lt;/P&gt;&lt;P&gt;1- The URL variable won't work unless it is added to current not only initial value in the environment variable.&lt;/P&gt;&lt;P&gt;2- Switching SSL off in the settings&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the output results, it also set the access id token &amp;lt;&lt;SPAN style="font-family: inherit;"&gt;authToken&lt;/SPAN&gt;&amp;gt; environment variable as per the code.&lt;/P&gt;&lt;PRE&gt;curl --request POST 'https://aeadsaswf01-afs.adfca.ae/casManagement/servers/cas-shared-default/sessions' \
--header 'Content-Type: application/vnd.sas.cas.session+json' \
--header 'Authorization: Bearer eyJhb...............'&lt;/PRE&gt;&lt;P&gt;The output console:&lt;/P&gt;&lt;DIV class="mceNonEditable lia-copypaste-placeholder"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;Host name is mandatory (although&amp;nbsp;it is not mentioned in the code above), I chose to set it manually.&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;&lt;DIV class="mceNonEditable lia-copypaste-placeholder"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="network-string__name"&gt;&lt;STRONG&gt;Request Headers&lt;/STRONG&gt;&lt;/DIV&gt;&lt;DIV class="network-formatter__item"&gt;&lt;SPAN&gt;&lt;SPAN class="wf__item"&gt;&lt;SPAN class="wf__tk"&gt;Content-Type&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;:&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="network__value"&gt;&lt;SPAN class="wf__item"&gt;&lt;SPAN class="wf__tk"&gt;application/vnd.sas.cas.session+json&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="network-formatter__item"&gt;&lt;SPAN&gt;&lt;SPAN class="wf__item"&gt;&lt;SPAN class="wf__tk"&gt;Authorization&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;:&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="network__value"&gt;&lt;SPAN class="wf__item"&gt;&lt;SPAN class="wf__tk"&gt;Bearer eyJh...........&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="network-formatter__item"&gt;&lt;SPAN&gt;&lt;SPAN class="wf__item"&gt;&lt;SPAN class="wf__tk"&gt;User-Agent&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;:&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="network__value"&gt;&lt;SPAN class="wf__item"&gt;&lt;SPAN class="wf__tk"&gt;PostmanRuntime/7.25.0&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="network-formatter__item"&gt;&lt;SPAN&gt;&lt;SPAN class="wf__item"&gt;&lt;SPAN class="wf__tk"&gt;Accept&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;:&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="network__value"&gt;&lt;SPAN class="wf__item"&gt;&lt;SPAN class="wf__tk"&gt;*/*&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="network-formatter__item"&gt;&lt;FONT color="#FF0000"&gt;&lt;SPAN&gt;&lt;SPAN class="wf__item"&gt;&lt;SPAN class="wf__tk"&gt;Host&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;SPAN&gt;:&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="network__value"&gt;&lt;SPAN class="wf__item"&gt;&lt;SPAN class="wf__tk"&gt;aeadsaswf01-afs.adfca.ae&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="network-formatter__item"&gt;&lt;SPAN&gt;&lt;SPAN class="wf__item"&gt;&lt;SPAN class="wf__tk"&gt;Accept-Encoding&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;:&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="network__value"&gt;&lt;SPAN class="wf__item"&gt;&lt;SPAN class="wf__tk"&gt;gzip, deflate, br&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="network-formatter__item"&gt;&lt;SPAN&gt;&lt;SPAN class="wf__item"&gt;&lt;SPAN class="wf__tk"&gt;Connection&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;:&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="network__value"&gt;&lt;SPAN class="wf__item"&gt;&lt;SPAN class="wf__tk"&gt;keep-alive&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="network-formatter__item"&gt;&lt;SPAN&gt;&lt;SPAN class="wf__item"&gt;&lt;SPAN class="wf__tk"&gt;Content-Length&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;:&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="network__value"&gt;&lt;SPAN class="wf__item"&gt;&lt;SPAN class="wf__tk"&gt;0&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="mceNonEditable lia-copypaste-placeholder"&gt;&amp;nbsp;&lt;/DIV&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>Wed, 10 Jun 2020 14:05:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/Postman-Pre-Request-Authorization-Script-to-access-SAS-VIYA-APIs/m-p/656423#M826</guid>
      <dc:creator>WaelAburezeq</dc:creator>
      <dc:date>2020-06-10T14:05:09Z</dc:date>
    </item>
    <item>
      <title>Re: Postman Pre-Request Authorization Script to access SAS VIYA APIs</title>
      <link>https://communities.sas.com/t5/Developers/Postman-Pre-Request-Authorization-Script-to-access-SAS-VIYA-APIs/m-p/673147#M886</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/161470"&gt;@WaelAburezeq&lt;/a&gt;,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Were you ever able to get the pre-req script to run? I copied the JSON you provided in an earlier comment and was able to get an access token. Perhaps there is a stray character in your pm.sendRequest JSON that is causing the '&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="prscript-error-message"&gt;Error: Unexpected token u in JSON at position 0' error. The 'u' in the error represents undefined, which normally indicates a parsing error with the JSON code.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;Joe&lt;/P&gt;</description>
      <pubDate>Wed, 29 Jul 2020 14:30:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/Postman-Pre-Request-Authorization-Script-to-access-SAS-VIYA-APIs/m-p/673147#M886</guid>
      <dc:creator>joeFurbee</dc:creator>
      <dc:date>2020-07-29T14:30:31Z</dc:date>
    </item>
  </channel>
</rss>

