<?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  : PKIX path building failed in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/PROC-http-PKIX-path-building-failed/m-p/656348#M196789</link>
    <description>Thanks for the reply, will chase up on this</description>
    <pubDate>Wed, 10 Jun 2020 10:44:23 GMT</pubDate>
    <dc:creator>dennis_oz</dc:creator>
    <dc:date>2020-06-10T10:44:23Z</dc:date>
    <item>
      <title>PROC http  : PKIX path building failed</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-http-PKIX-path-building-failed/m-p/656338#M196785</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/134976"&gt;@danielmitu&lt;/a&gt;&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/35204"&gt;@JuanS_OCS&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;hi all , I am trying to make a call to the below api&amp;nbsp; and I get the below java certification error ..&lt;/P&gt;
&lt;P&gt;is there anyway to get around this . I am using SAS&amp;nbsp;version: 9.03.01M2P08152012&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for your help&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;filename out "\....\REQUEST1";
filename hdrs "\....\out.txt";
proc http
url="https://verint.internal.xxx.com.au/wfo/rest/core-api/auth/token"
method="Post"
out=out
headerout=hdrs;
run;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;ERROR: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: 
sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target&lt;/PRE&gt;</description>
      <pubDate>Wed, 10 Jun 2020 10:04:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-http-PKIX-path-building-failed/m-p/656338#M196785</guid>
      <dc:creator>dennis_oz</dc:creator>
      <dc:date>2020-06-10T10:04:32Z</dc:date>
    </item>
    <item>
      <title>Re: PROC http  : PKIX path building failed</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-http-PKIX-path-building-failed/m-p/656342#M196787</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/19264"&gt;@dennis_oz&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;it would seem to me as the SSL handshake is failing between the webpage security and the certificates available in the Java certificate store used by your SAS 9.3 installation.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is what you and your IT teams need to do:&lt;/P&gt;
&lt;P&gt;1- get the certificate path (individual certifiicates) from the webpage. Y0u can do this with Internet Explorer or Chrome. The certificates must be saved in PEM base64 format.&lt;/P&gt;
&lt;P&gt;2- locate the Java JRE used by your SAS 9.3 installation.&lt;/P&gt;
&lt;P&gt;3- Import those certificates into the certificate store of that Java installation, with a java tool named keytool.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;4- Just to be sure, install those certificates as well in your machine certificate store, where SAS runs&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When you import&amp;nbsp; certificates, use the same order as in the path. First the CA certificate, then intermediates, and finally the end certificate.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Once you do this, your code should not give a PKIX error anymore.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best regards,&lt;/P&gt;
&lt;P&gt;Juan&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jun 2020 10:13:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-http-PKIX-path-building-failed/m-p/656342#M196787</guid>
      <dc:creator>JuanS_OCS</dc:creator>
      <dc:date>2020-06-10T10:13:54Z</dc:date>
    </item>
    <item>
      <title>Re: PROC http  : PKIX path building failed</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-http-PKIX-path-building-failed/m-p/656348#M196789</link>
      <description>Thanks for the reply, will chase up on this</description>
      <pubDate>Wed, 10 Jun 2020 10:44:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-http-PKIX-path-building-failed/m-p/656348#M196789</guid>
      <dc:creator>dennis_oz</dc:creator>
      <dc:date>2020-06-10T10:44:23Z</dc:date>
    </item>
    <item>
      <title>Re: PROC http  : PKIX path building failed</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-http-PKIX-path-building-failed/m-p/656390#M196803</link>
      <description>&lt;P&gt;Hi @JuanS_OCS ,&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/214450"&gt;@joeFurbee&lt;/a&gt;&amp;nbsp;,&lt;A href="https://communities.sas.com/t5/user/viewprofilepage/user-id/41748" target="_blank"&gt;@alexal&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;,@h-elmu-t&lt;/SPAN&gt;&lt;BR /&gt;I am giving a crack at something else i found over here&lt;/P&gt;
&lt;P&gt;&lt;A href="https://communities.sas.com/t5/Developers/Authentication-OAuth-2nd-PROC-HTTP-fails/m-p/640008#M733" target="_blank"&gt;https://communities.sas.com/t5/Developers/Authentication-OAuth-2nd-PROC-HTTP-fails/m-p/640008#M733&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am supposed do something like this as per the instructions from the owner of the API&lt;/P&gt;
&lt;PRE&gt;filename resp temp;

proc http url="https://mysasserver.net:443/SASLogon/oauth/token"
method='post'
in="grant_type=password%nrstr(&amp;amp;username=)&amp;amp;USERNAME.%nrstr(&amp;amp;password=)&amp;amp;PASSWORD."
username="&amp;amp;CLIENT_ID."
password="&amp;amp;CLIENT_SECRET."
out=resp
auth_basic verbose;
debug level=3;
run;

libname tokens json "%sysfunc(pathname(resp))";
%global ACCESS_TOKEN;

proc sql noprint;
select access_token into:ACCESS_TOKEN, from tokens.root;
quit;&lt;/PRE&gt;
&lt;PRE&gt;%let username='SVCTESTCRMAUTOXX';&lt;BR /&gt;%let password=XXXXXXX;

31         proc http url="https://XXXXXXX/wfo/rest/core-api/auth/token"
32         	method='post'
33         	in="grant_type=password%nrstr(&amp;amp;username=)&amp;amp;USERNAME.%nrstr(&amp;amp;password=)&amp;amp;PASSWORD."
NOTE: Line generated by the macro variable "PASSWORD".
33         "grant_type=password&amp;amp;username='SVCTESTCRMAUTOXX'&amp;amp;password=XXXXXXX
           __________________________________________________________________________
           22
ERROR 22-322: Expecting a name.  

34         	username="&amp;amp;CLIENT_ID."
WARNING: Apparent symbolic reference CLIENT_ID not resolved.
NOTE: Line generated by the macro variable "PASSWORD".
33         "grant_type=password&amp;amp;username='SVCTESTCRMAUTOXX'&amp;amp;password=XXXXXXX
           __________________________________________________________________________
           76
ERROR 76-322: Syntax error, statement will be ignored.

35         	password="&amp;amp;CLIENT_SECRET."
WARNING: Apparent symbolic reference CLIENT_SECRET not resolved.
36         	out=resp
37         	auth_basic verbose;
38         	run;&lt;/PRE&gt;
&lt;P&gt;I only have username , url and password .&amp;nbsp; I have no idea of a grant_type. any pointers will be appreciated&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":grinning_face_with_sweat:"&gt;😅&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jun 2020 12:41:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-http-PKIX-path-building-failed/m-p/656390#M196803</guid>
      <dc:creator>dennis_oz</dc:creator>
      <dc:date>2020-06-10T12:41:41Z</dc:date>
    </item>
    <item>
      <title>Re: PROC http  : PKIX path building failed</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-http-PKIX-path-building-failed/m-p/657533#M197037</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/19264"&gt;@dennis_oz&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;To run the proc http code in the example is requesting an access token from SAS Viya. In order to fulfill the request, you need to register your client and use the clientid and clientsecret in the username and password parameters.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There are multiple articles and tools you can use to register the client. Here are a couple of resources:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://developer.sas.com/reference/auth/#register" target="_self"&gt;Registering Clients&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://blogs.sas.com/content/sgf/2019/01/25/authentication-to-sas-viya/" target="_self"&gt;Authentication to SAS Viya: a couple of approaches&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/Add-These-Tools-to-Your-SAS-Viya-Developer-s-Toolbox/ta-p/648633" target="_self"&gt;Add These Tools to Your SAS Viya Developer's Toolbox&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.linkedin.com/posts/allanbowe_sasjs-sas-viya-activity-6670420449324736512-vQnk/" target="_self"&gt;&lt;SPAN&gt;The one-click SAS Viya Token Generator&lt;/SPAN&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In the end you can test out your code and see the results of for the access token, using grant_type=password, with the following code:&lt;/P&gt;
&lt;PRE&gt;proc http url="http://mysasserver.sas.com/SASLogon/oauth/token" 
method="POST" 
auth_basic
username="myclientid"
password="myclientsecret"
in='grant_type=password&amp;amp;username=sasuser&amp;amp;password=saspassword'
headerout=hdrs
headerout_overwrite
out=out;
headers "Accept"="application/json";
run;

data _null_;
  rc = jsonpp('out','log');
run;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 17 Jul 2020 20:48:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-http-PKIX-path-building-failed/m-p/657533#M197037</guid>
      <dc:creator>joeFurbee</dc:creator>
      <dc:date>2020-07-17T20:48:42Z</dc:date>
    </item>
  </channel>
</rss>

