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

Re: [Ftpapi] Preemptive authentication



Thanks Scott,

I'll discuss with my integration team..

On Thu, Jun 28, 2018 at 4:21 PM, Scott Klement <sk@xxxxxxxxxxxxxxxx> wrote:
Hi Robin,

To me, "preemptive" implies that you call http_setAuth() before calling http_string(). 

From your code, it appears that you are already doing it preemptively -- at least, you are if P$User and P$Pwd aren't blank.

The other (non-preemptive) way would be to call http_string() first, and then if you got a 401 error, call http_getAuth() to find out what it's asking for, then http_setAuth() and finally http_string() a second time.  This is not preemptive because you didn't send the userid/password until after trying it the first time.  But, you don't seem to be doing that.

Could it be that your integration team is taking a wild guess at it instead of actually looking at what is sent?

-SK



On 6/28/2018 8:04 AM, Robin Jacob wrote:

Hi,


We are occasionally getting connection failure with HTTP401 errors   This page requires a user-id & password” while trying to post JSON payload.

 

Suggestion from our integration team is to enable Preemptive authentication with in our Http Client software to avoid this failure.

 

Current code

----------------------------------------------------------------------------------------

 // Basic Authentication                         

 If P$User <> *Blanks and P$Pwd <> *Blanks;      

    user = %TRIM(P$User);                        

    pwd  = %TRIM(P$Pwd);                         

    http_setAuth(HTTP_AUTH_BASIC :User:Pwd);     

 Endif;                                          

                                                 

 monitor;                                        

  Return  (http_string( method: P$URI: P$Req     

  : 'application/json' ));                       

  on-error;                                      

  P$Msg = http_error();                          

  endmon;                                        

                                                 

 End-Proc TransportPayload;                      


-----------------------------------------------------------------------------------------------




Need you help to address this issue. 


Thanks

Robin







--
_______________________________________________
Ftpapi mailing list
Ftpapi@xxxxxxxxxxxxxxxxxxxxxx
http://scottklement.com/mailman/listinfo/ftpapi


-- 
_______________________________________________
Ftpapi mailing list
Ftpapi@xxxxxxxxxxxxxxxxxxxxxx
http://scottklement.com/mailman/listinfo/ftpapi