[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Unsupported_grant_type



   could you try something like
   tempFile = '/tmp/test.txt';
     url = 'https://202.47.1.145/adfAPI/token?-
    grant_type=password&username=PSI&password=Rohit66';
   rc = http_url_get(URL:tempFile);
   Cordialement, Kind Regards,
   Merci, thank you,
   Paul

     [cid:_1_B210A484B210A1E4002B89F4C1257FB8]
   Paul Roy
   paul.roy@xxxxxxx
   +352 621 256 810
   +32 477 971 925
   REAL Solutions S.A.
   33, rue d'Eich
   L-1461 Luxembourg
   [1]real.lu
   REAL Solutions Facebook   [cid:_1_B210D264B210CD6C002B89F4C1257FB8]
   [cid:_1_B210D4D4B210CD6C002B89F4C1257FB8]

      This email and any files transmitted with it are confidential and
    intended solely for the use of the individual or entity to whom they
    are addressed. If you have received this email in error please notify
                             the system manager.
       [cid:_1_B210EAE4B210E6C8002B89F4C1257FB8]  Please consider the
                  environment before printing this e-mail.

   From:        "Tony Cesarios" <tony@xxxxxxxxxxxxxxxxxxx>
   To:        "'HTTPAPI and FTPAPI Projects'"
   <ftpapi@xxxxxxxxxxxxxxxxxxxxxx>
   Date:        30/06/2016 11:14
   Subject:        RE: Unsupported_grant_type
   Sent by:        ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
     __________________________________________________________________

   Hi Paul,
   Did the change and now get the original problem of
   "unsupported_grant_type".
   Here's the dump:
   File CCSID changed to1208
   http_url_post(): entered
   http_persist_open(): entered
   http_long_ParseURL(): entered
   DNS resolver retrans: 2
   DNS resolver retry  : 2
   DNS resolver options: x'00000136'
   DNS default domain: PETERSTEVENS.COM.AU
   DNS server found: 172.16.1.20
   -----------------------------------------------------------------------
   -----
   ---------
   Dump of server-side certificate information:
   -----------------------------------------------------------------------
   -----
   ---------
   Cert Validation Code = 6000
   -----BEGIN CERTIFICATE-----
   MIICyjCCAbKgAwIBAgIQGpVT56MDf7JJlY/xMep6IDANBgkqhkiG9w0BAQUFADAO
   MQwwCgYDVQQDEwNBRlMwHhcNMTYwNjIyMDkyNTI0WhcNMTcwNjIyMDAwMDAwWjAO
   MQwwCgYDVQQDEwNBRlMwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCm
   GgG+Sw+no7BIBaEsAvoAQvnHISviKtHI/yjmxCsqG7v/QF+ENTlYil4FWTCIBGZr
   dShWxyUeEhTwmTXY7drkOQKn/iLZcpqyIdsCDaqBZGpoWmZxeTFIsQmQGRRoXDM1
   qFB4vaO7WIgSrDd5RaWj8bn6/MgxDtjRTFnEsC3apBglivWVA//knvm3V264MdiP
   59uXPyQ/bgT+z76Eq5kSP2oMzRXbkqqxG1evcqwluyB3uY+zyo9u5/BABPzmbKAU
   to4d0OYwJgr5b3VX5PiXG/aFmmlGzdeZF4tPkJenBeqkM5+B4CLcLMX++9bJzOS3
   m4XLq+0VHoC5hlmQPNUhAgMBAAGjJDAiMAsGA1UdDwQEAwIEMDATBgNVHSUEDDAK
   BggrBgEFBQcDATANBgkqhkiG9w0BAQUFAAOCAQEAT/GQTkCj60CZRTiWiaSx5dUV
   LclrKcnT9+5BjctbhYP4YtaHfjN3GbZwqslcqlepTau7aV9Prj9PlIJtYug+W531
   WQJSGe6LGk5uKsU1mFBPVWzDr57gfAWcnT3UO2O9deFDBLOOn/8XJHTcDpdAMmC/
   DjPX32AyZxeUOmGR4Bi5oHB1i7NESnwTxRFRiQ/OgGV9Kdr+8TB5gL/9iwmPxBFE
   Ei74epRaRHLfxhKsBZ2VSw9CQaPy1beCenWjuIsZmPPDnJk+IPYOZiD9hvG/ud8m
   buIAybGcsfT+aSJFOYG7vetPjmC2rsoJ8hpXuq54jooDtuRrSFMC8K30Ht419Q==
   -----END CERTIFICATE-----
   Serial Number: 1A:95:53:E7:A3:03:7F:B2:49:95:8F:F1:31:EA:7A:20
   Common Name: AFS
   Issuer CN: AFS
   Version: 3
   not before: 20160622192524
   Unknown Field: 19:25:24 22-06-2016
   not after: 20170622100000
   Unknown Field: 10:00:00 22-06-2017
   pub key alg: 1.2.840.113549.1.1.5
   Protocol Used: TLS Version 1
   http_persist_post(): entered
   http_long_ParseURL(): entered
   do_post(): entered
   POST /adfAPI/token?grant_type=password&username=PSI&password=Rohit66
   HTTP/1.1
   Host: 202.47.1.145
   User-Agent: http-api/1.23
   Content-Type: application/x-www-form-urlencoded
   Expect: 100-continue
   Content-Length: 79
   recvresp(): entered
   HTTP/1.1 100 Continue
   SetError() #13: HTTP/1.1 100 Continue
   senddoc(): entered
   À %      £m£¨  ~ z   ¢¢¦     % k ¤¢      ~ z ×âÉ  % k   ¢¢¦   ~ z Ù
   £öö
   %Ð %
   recvresp(): entered
   HTTP/1.1 400 Bad Request
   Cache-Control: no-cache
   Pragma: no-cache
   Content-Length: 34
   Content-Type: application/json;charset=UTF-8
   Expires: -1
   Server: Microsoft-IIS/8.0
   X-Powered-By: ASP.NET
   Date: Thu, 30 Jun 2016 08:54:41 GMT
   SetError() #13: HTTP/1.1 400 Bad Request
   recvdoc parms: identity 34
   header_load_cookies() entered
   recvdoc(): entered
   SetError() #0:
   {"error":"unsupported_grant_type"}
   SetError() #13: HTTP/1.1 400 Bad Request
   http_close(): entered
   I've also include a copy of the program used in case you can spot any
   issues:
   /copy pextcd2/qsrc,pxapihdr      General H-Spec's
   * powerEXT Service Program Connector
   /copy pextcd2/qsrc,pxapicgicn    Basic HTTP connecter & Productivity
   Services
   /copy pextcd2/qsrc,pxapijsncn    YAJL JSON connector
   * Support for HTTPAPI by Scott Klement
   /copy qrpglesrc,httpapi_h
   * Declare Internal Variables
   d dsp             s             50A
   d dspwait         s              1A
   d rc              s             10I 0
   d i               s             10I 0
   d url             s           2048A   Varying
   d Content         s            256A   Varying

   d tmpFile         s            256a   varying

   d jsonAddr        s               *
   d jsonSize        s             10u 0

   /free
    // Clear powerEXT Service Program & Responce Object
    clearSrvPgm();

    // Construct a temporary result file name for HTTPAPI
    tmpFile = '/tmp/tst'+uniqueKey+'.json';

    // Setup HTTPAPI Url and parms
    HTTP_debug(*on);
    HTTP_SetCCSIDs(1208:1208);
    HTTP_SetFileCCSID(1208);
    url = 'https://202.47.1.145/adfAPI/token?-
    grant_type=password&username=PSI&password=Rohit66';

    // Send HTTPAPI Request
    rc = http_url_post( url
                      : bufAddr()
                      : bufSize()
                      : tmpfile
                      : HTTP_TIMEOUT
                      : 'http-api/1.23'
                      : 'application/x-www-form-urlencoded');

    // HTTPAPI Error Handling
    if rc <> 1;
      dsply %char(rc);
      dsp = http_error;
      dsply  dsp;
      *inlr = *on;
      return;
    endif;

    // Display HTTPAPI result with qcmd method
    qcmd('dspf (''' + tmpFile + ''')');

    // Delete object with qcmd method
    qcmd('del (''' + tmpFile + ''')');

    *inlr = *on;
   /end-free
   I somehow think the problem resides with the Content-Type: application
   /x-www-form-urlencoded have tried using application/json but same
   issue.
   Regards,
   Tony
   -----Original Message-----
   From: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
   [[2]mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Paul Roy
   Sent: Thursday, June 30, 2016 6:24 PM
   To: HTTPAPI and FTPAPI Projects <ftpapi@xxxxxxxxxxxxxxxxxxxxxx>
   Subject: RE: Unsupported_grant_type
   Hi , or like
   url =
   'https://202.47.1.145/adfAPI/token?grant_type=password&username=PSI&pas
   sword
   =Rohit66';
   Paul
   Paul Roy
   paul.roy@xxxxxxx
   +352 621 256 810
   +32 477 971 925
   REAL Solutions S.A.
   33, rue d'Eich
   L-1461 Luxembourg
   real.lu

   This email and any files transmitted with it are confidential and
   intended
   solely for the use of the individual or entity to whom they are
   addressed.
   If
   you have received this email in error please notify the system manager.
   Please consider the environment before printing this e-mail.
   From:   "Tony Cesarios" <tony@xxxxxxxxxxxxxxxxxxx>
   To:     "'HTTPAPI and FTPAPI Projects'" <ftpapi@xxxxxxxxxxxxxxxxxxxxxx>
   Date:   30/06/2016 10:04
   Subject:        RE: Unsupported_grant_type
   Sent by:        ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
   Hi Paul,
   So your suggestion is to make the change as follows to the RPG ILE
   program:
   // Construct a temporary result file name for HTTPAPI
   tmpFile = '/tmp/tst'+uniqueKey+'.json';
   // Setup HTTPAPI Url and parms
   HTTP_debug(*on);
   HTTP_SetCCSIDs(1208:1208);
   HTTP_SetFileCCSID(1208);
   url = 'https://202.47.1.145/adfAPI/token/-
   grant_type=password&username=PSI&password=Rohit66';
   // Send HTTPAPI Request
   rc = http_url_post( url
                    : bufAddr()
                    : bufSize()
                    : tmpfile
                    : HTTP_TIMEOUT
                    : 'http-api/1.23'
                    : 'application/x-www-form-urlencoded');
   Which I did but got the following issue:
   <!DOCTYPE html>
   <html>
      <head>
          <title>A potentially dangerous Request.Path value was detected
   from
   the client (&amp;).</title>
          <meta name="viewport" content="width=device-width" />
          <style>
           body {font-family:"Verdana";font-weight:normal;font-size:
   .7em;color:black;}
           p
   {font-family:"Verdana";font-weight:normal;color:black;margin-top:
   -5px}
           b
   {font-family:"Verdana";font-weight:bold;color:black;margin-top:
   -5px}
           H1 {
   font-family:"Verdana";font-weight:normal;font-size:18pt;color:red }
           H2 {
   font-family:"Verdana";font-weight:normal;font-size:14pt;color:maroon }
           pre {font-family:"Consolas","Lucida
   Console",Monospace;font-size:11pt;margin:0;padding:0.5em;line-height:14
   pt}
           .marker {font-weight: bold; color: black;text-decoration:
   none;}
           .version {color: gray;}
           .error {margin-bottom: 10px;}
           .expandable { text-decoration:underline; font-weight:bold;
   color:navy; cursor:hand; }
           @media screen and (max-width: 639px) {
            pre { width: 440px; overflow: auto; white-space: pre-wrap;
   word-wrap: break-word; }
           }
           @media screen and (max-width: 479px) {
            pre { width: 280px; }
           }
          </style>
      </head>
      <body bgcolor="white">
              <span><H1>Server Error in '/adfAPI' Application.<hr
   width=100%
   size=1 color=silver></H1>
              <h2> <i>A potentially dangerous Request.Path value was
   detected
   from the client (&amp;).</i> </h2></span>
              <font face="Arial, Helvetica, Geneva, SunSans-Regular,
   sans-serif ">
              <b> Description: </b>An unhandled exception occurred during
   the
   execution of the current web request. Please review the stack trace for
   more
   information about the error and where it originated in the code.
              <br><br>
              <b> Exception Details: </b>System.Web.HttpException: A
   potentially dangerous Request.Path value was detected from the client
   (&amp;).<br><br>
              <b>Source Error:</b> <br><br>
              <table width=100% bgcolor="#ffffcc">
                 <tr>
                    <td>
                        <code>
   An unhandled exception was generated during the execution of the
   current
   web
   request. Information regarding the origin and location of the exception
   can
   be identified using the exception stack trace below.</code>
                    </td>
                 </tr>
              </table>
              <br>
              <b>Stack Trace:</b> <br><br>
              <table width=100% bgcolor="#ffffcc">
                 <tr>
                    <td>
                        <code><pre>
   [HttpException (0x80004005): A potentially dangerous Request.Path value
   was
   detected from the client (&amp;).]
     System.Web.HttpRequest.ValidateInputIfRequiredByConfig() +9817224
     System.Web.PipelineStepManager.ValidateHelper(HttpContext context)
   +53
   </pre></code>
                    </td>
                 </tr>
              </table>
              <br>
              <hr width=100% size=1 color=silver>
              <b>Version Information:</b>&nbsp;Microsoft .NET Framework
   Version:4.0.30319; ASP.NET Version:4.6.1055.0
              </font>
      </body>
   </html>
   <!-- [HttpException]: A potentially dangerous Request.Path value was
   detected from the client (&amp;).   at
   System.Web.HttpRequest.ValidateInputIfRequiredByConfig()   at
   System.Web.HttpApplication.PipelineStepManager.ValidateHelper(HttpConte
   xt context) --><!-- -----Original Message----- From:
   ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
   [[3]mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Paul Roy
   Sent: Thursday, June 30, 2016 5:24 PM To: HTTPAPI and FTPAPI Projects
   <ftpapi@xxxxxxxxxxxxxxxxxxxxxx> Subject: RE: Unsupported_grant_type I
   guess you should use a simple HTTP POST of the full string  (&user= ..
   &password=)  in the URL (not in JSON format) ... Paul Paul Roy
   paul.roy@xxxxxxx +352 621 256 810 +32 477 971 925 REAL Solutions S.A.
   33, rue d'Eich L-1461 Luxembourg real.lu This email and any files
   transmitted with it are confidential and intended solely for the use of
   the individual or entity to whom they are addressed. If you have
   received this email in error please notify the system manager. Please
   consider the environment before printing this e-mail. From:   "Tony
   Cesarios" <tony@xxxxxxxxxxxxxxxxxxx> To:     "'HTTPAPI and FTPAPI
   Projects'" <ftpapi@xxxxxxxxxxxxxxxxxxxxxx> Date:   30/06/2016 05:49
   Subject:        RE: Unsupported_grant_type Sent by:
   ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx Hi Scott, Have included what
   SOAPUI setup is for this issue. I guess if we are using REST with JSON
   the form section where should that appear in a request sent using
   HTTP_URI_POST. Regards, Tony [attachment "image001.gif" deleted by Paul
   Roy/REAL] [attachment "image002.png" deleted by Paul Roy/REAL]
   -----------------------------------------------------------------------
   This is the FTPAPI mailing list.  To unsubscribe, please go to:
   [4]http://www.scottklement.com/mailman/listinfo/ftpapi
   -----------------------------------------------------------------------
   -----------------------------------------------------------------------
   This is the FTPAPI mailing list.  To unsubscribe, please go to:
   [5]http://www.scottklement.com/mailman/listinfo/ftpapi
   -----------------------------------------------------------------------
   -----------------------------------------------------------------------
   This is the FTPAPI mailing list.  To unsubscribe, please go to:
   [6]http://www.scottklement.com/mailman/listinfo/ftpapi
   -----------------------------------------------------------------------

References

   1. http://www.real.lu/
   2. mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
   3. mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
   4. http://www.scottklement.com/mailman/listinfo/ftpapi
   5. http://www.scottklement.com/mailman/listinfo/ftpapi
   6. http://www.scottklement.com/mailman/listinfo/ftpapi

GIF image

GIF image

GIF image

GIF image

GIF image

-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------