Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

HTTP POST and GET using authentication cookie

tony_raimo2
Explorer
0 Likes
2,020

I'm trying to post data to a URL, but first I need to authenticate. The steps are as follows:

HTTP POST to https://www.xxxx.com/LOGIN passing username and password

Get cookie that is passed back

HTTP GET from https://www.xxxx.com/LOGIN using auth cookie

HTTP POST to https://www.xxxx.com/postdata.aspx using auth cookie

I can capture the auth cookie that is returned in the first post using

http_client->PROPERTYTYPE_ACCEPT_COOKIE = http_client->CO_ENABLED .

CALL METHOD: http_client->response->get_cookies( changing cookies = lt_cookies ).

Then I pass the cookie to the next POST like this:

loop at lt_cookies into ls_cookies.

CALL METHOD http_client->request->SET_COOKIE

exporting

NAME = ls_cookies-name

PATH = ls_cookies-path

VALUE = ls_cookies-value

  • DOMAIN = ls_cookies-xdomain

EXPIRES = ls_cookies-expires

SECURE = ls_cookies-secure.

endloop.

what I see happening in the ICM logs is that the cookie value that I get back from the first call is NOT URL Encoded. However, when I pass the cookie to the next request the cookie is URL encoded and the POST fails with a 403 errror.

This is the cookie value returned in first call:

erptest:2011-01-29-15-22-21:2011-01-30-15-22-21::7da37b826abd4f86dcf9ac5e5304b880:1

This is the cookie value passed to the next call:

erptest%3a2011-01-29-15-22-21%3a2011-01-30-15-22-21%3a%3a7da37b826abd4f86dcf9ac5e5304b880%3a1

Anybody know how to properly pass a cookie to a POST without it being URL encoded

Thank you,

Edited by: Tony Raimo on Jan 29, 2011 9:55 PM

Edited by: Tony Raimo on Jan 29, 2011 10:02 PM

2 REPLIES 2
Read only

tony_raimo2
Explorer
0 Likes
1,175

Here is the answer. check out note 1160362. Basically, you need to set parameter ict/disable_cookie_urlencoding = 1

Read only

0 Likes
1,175

Hi Tony,

I have a scenario which is exactly similar to the above post from your end. Request your help for the same.

I too have 2 urls; one for authenticating and another for posting the data. I have been able to successfully authenticate and in receiving 4 cookies in response.

However, being unfamiliar with the steps required for HTTP post and how the cookies are to be passed for the next url, I am not able to post the data to the 2nd URL. Could you please advise on the same.

Thank you,

Charles