Question

Using saved cookies in HTTP caller


Badge +6

Hi,

I made a successful HTTP call (POST) and saved cookies.

And also I was able to make GET HTTP call 1 using the above cookies in the Header fields.

I also need to make another subsequent HTTP call 2 with already saved cookies earlier. How can I make this subsequent request with already saved cookies?

Currently I get unauthorized error.

Please help @takashi, @DeanAtSafe, @jlutherthomas, @trentatsafe, @danilo_fme

Thank You,


8 replies

Userlevel 2
Badge +17

Hi @fmeuser_gc, try setting Yes to the Save Cookies parameter in all the HTTPCallers. See the help to learn more.

"Save Cookies: If this parameter is set to Yes, any saved cookies that correspond to the URL being accessed will be sent with the request. In addition, any cookies contained in the response will be saved for use with subsequent HTTP requests." -- HTTPCaller Help

Badge +6

Hi @takashi, I've tried setting 'Save cookies' in all callers and it's still same issue.

The challenge here is how to pass the cookies to the subsequent HTTP requests? I was only able to pass the cookie to the first HTTPCaller after the cookies have been generated.

Userlevel 2
Badge +17

Hi @takashi, I've tried setting 'Save cookies' in all callers and it's still same issue.

The challenge here is how to pass the cookies to the subsequent HTTP requests? I was only able to pass the cookie to the first HTTPCaller after the cookies have been generated.

  • Are the HTTPCallers connected in series?
  • Did you remove cookies which you had specified through the Headers fields?
  • Perhaps does the web page require authentication other than cookies?
Badge +6
  • Are the HTTPCallers connected in series?
  • Did you remove cookies which you had specified through the Headers fields?
  • Perhaps does the web page require authentication other than cookies?
  • Yes they are connected in series. Attached screenshot.
  • Here I couldn't pass the cookies to the HTTPCaller_3. However I was only able to pass cookie only to the HTTPCaller_2 (All HTTPCallers have 'Save Cookie' set to YES)
  • Source provider confirmed there is no need of authentication other than cookies.

 

 

 

 

 

Also I get this error when I set the cookies to YES.

 

 

HTTPCaller_3(HTTPFactory): HTTP/FTP transfer error: 'Failed writing received data to disk/application'

 

HTTPCaller_3(HTTPFactory): Please ensure that your network connection is properly set up

 

HTTPCaller_3(HTTPFactory): No proxy settings have been entered. If you require a proxy to access external URLs, please ensure the appropriate information has been entered
Userlevel 2
Badge +17

Hi @takashi, I've tried setting 'Save cookies' in all callers and it's still same issue.

The challenge here is how to pass the cookies to the subsequent HTTP requests? I was only able to pass the cookie to the first HTTPCaller after the cookies have been generated.

What does the first HTTPCaller perform? Perhaps do you intend to login a web site with username etc.?

 

 

Badge +6
What does the first HTTPCaller perform? Perhaps do you intend to login a web site with username etc.?

 

 

First HTTP caller authenticates and Return cookies in Header. These cookies needs to be used in further calls.

 

 

Userlevel 2
Badge +17

Hi @takashi, I've tried setting 'Save cookies' in all callers and it's still same issue.

The challenge here is how to pass the cookies to the subsequent HTTP requests? I was only able to pass the cookie to the first HTTPCaller after the cookies have been generated.

I don't know it can be applied to your case, but in some web sites, you need to access the login page with GET method at first (start a new session, create cookie), and then send authentication data (username etc.) with POST method.

 

 

Badge

Hi @fmeuser_gc,

An unauthorized error indicates that the authentication & authorization for your request failed. This is not necessarily related to the cookies.

 

To identify the cause of the failure we need more details of the service you are trying to call:
  • Is there a documentation of the service that describes how to authenticate?
  • Does the service provide an API or is it just a regular website?
  • Did you use the "Use Authentication" option in the HTTPCaller? Which one?
  • If not, how did you authenticate?
  • Did you set all required Headers and Query Parameters for your request?
  • Can you share the full response of the unauthorized failing request?
  • Can you authenticate successfully with a different client? (REST Client or Browser)
  • If yes, are the Headers and Query Parameters & the Method similar to what you set in the HTTPCaller?

I hope this helps!

Reply