Hi everyone,
Please, I'm using HTTPAPI v1.4 and I need to solve this error: This page requires a user-id & password
The API-REST only requires authentication using the header parameters that are username and password.
This happens frequently and is intermittent.
Thank you in advance for your help,
Please, I'm using HTTPAPI v1.4 and I need to solve this error: This page requires a user-id & password
The API-REST only requires authentication using the header parameters that are username and password.
- Request Postman (Works 100% all time)
Code:
GET /Api/CardFormats? HTTP/1.1 Host: 192.168.1.XX:444 Content-Type: application/xml Accept: application/xml Username: user Password: password cache-control: no-cache
- My Code:
Code:
http_debug(*on); http_setAuth(HTTP_AUTH_NONE: '': ''); http_xproc( HTTP_POINT_ADDL_HEADER: *null ); http_xproc( HTTP_POINT_ADDL_HEADER: %paddr(add_headers) ); Response = *blanks; ResCode = *blanks; ResMessage = *blanks; monitor; Response = http_string( %trim(Method): %trim(URL): %trim(BodyCont): %trim(ContentType) ); http_error(*omit: httpstatus); ResCode = %char(0); ResMessage = %char(httpstatus); on-error; ResCode = %char(9); ResMessage = http_error(); endmon; *inlr = *on; ******************************************************************* P add_headers B D PI D headers 32767A varying D CRLF C x'0d25' /FREE headers = 'Content-Type: application/xml' + CRLF + 'Accept: application/xml' + CRLF + 'Username: ' + %trim(user) + CRLF + 'Password: ' + %trim(pass) + CRLF; /END-FREE
- httpapidebug.txt
- In some cases the response is:
Code:
Protocol Used: TLS Version 1.2 http_persist_req(GET) entered. http_long_ParseURL(): entered http_long_ParseURL(): entered do_oper(GET): entered There are 0 cookies in the cache GET /Api/CardFormats HTTP/1.1 Host: 192.168.1.XX:444 User-Agent: http-api/1.39 Content-Type: application/xml Accept: application/xml USERNAME: user PASSWORD: password recvresp(): entered HTTP/1.1 200 OK Cache-Control: no-cache Pragma: no-cache Content-Type: application/xml; charset=utf-8 Expires: -1 Server: Microsoft-IIS/8.5 Strict-Transport-Security: max-age=31536000 JWT: xxx Content-Security-Policy: script-src 'self'; X-AspNet-Version: 4.0.30319 X-Powered-By: [URL="http://ASP.NET"]ASP.NET[/URL] Date: Thu, 05 Sep 2019 15:44:53 GMT Content-Length: 504 SetError() Ñ13: HTTP/1.1 200 OK recvresp(): end with 200 recvdoc parms: identity 504 recvdoc parms: identity 504 header_load_cookies() entered recvdoc(): entered SetError() Ñ0: recvdoc(): Receiving 504 bytes. <XMLRESPONSE>... http_close(): entered
- If I try to consume several times, it succeeds without problem. But from one moment to another it stops working and begins to respond:
Code:
Protocol Used: TLS Version 1.0 http_persist_req(GET) entered. http_long_ParseURL(): entered http_long_ParseURL(): entered do_oper(GET): entered There are 0 cookies in the cache GET /Api/CardFormats HTTP/1.1 Host: 192.168.1.XX:444 User-Agent: http-api/1.39 Content-Type: application/xml Accept: application/xml USERNAME: user PASSWORD: password recvresp(): entered HTTP/1.1 401 192.168.1.7 Cache-Control: no-cache Pragma: no-cache Content-Length: 238 Content-Type: text/plain; charset=utf-8 Expires: -1 Server: Microsoft-IIS/8.5 Strict-Transport-Security: max-age=31536000 Content-Security-Policy: script-src 'self'; style-src 'self' 'unsafe-inline' X-AspNet-Version: 4.0.30319 X-Powered-By: [URL="http://ASP.NET"]ASP.NET[/URL] Date: Thu, 05 Sep 2019 15:18:32 GMT SetError() Ñ13: HTTP/1.1 401 192.168.1.7 recvresp(): end with 401 recvdoc parms: identity 238 SetError() Ñ36: This page requires a user-id & password AuthPlugin_mustReceiceAuthErrorPage(): entered http_close(): entered
Thank you in advance for your help,
Comment