Copy link to clipboard
Copied
Hello everyone,
I am trying to write a folder level script using javascript for acrobat API in acrobat pro. It should post to a HTTP server by a click on a toolbar button. I wrote the script using Net.HTTP.request() method which has a parameter 'aHeaders' to pass some headers along with the request. Since I am developing this for an organization, I need to pass some headers like Content-Type, Cookie, etc. When I try to pass a cookie, it does not pass through acrobat or we can say acrobat filter it out and at the server, I receive all headers in the request which I had added except the cookie. I checked this with the help of a network analyzer tool, Wireshark.
Can anyone provide a clue as to why is this happening? How can we solve this? Any help would be highly appreciated.
Thanks.
Edit: Below is my code for the same:
ajax = app.trustedFunction(function (furl){
app.beginPriv();
try {
Net.HTTP.request({
cVerb: "POST",
cURL: furl,
aHeaders: [ {name: "Content-Type" , value: "application/json"},
{name:"Cookie" , value:"sample_value"} ],
oHandler: ajaxcallbback
});
}catch(e){
console.println(e);
}
app.endPriv();
});
ajaxcallback = {
response: function(msg, url, e){
var stream = msg;
var string = "";
var error = e = undefined? "NO HTTP errors":"error: " + e.toSource();
console.println(error);
string = SOAP.stringFromStream(stream);
var oResult = JSON.parse(string);
console.println(oResult.submissionID);
}
app.addToolButton({
cName: "mytoolbutton",
cExec: "ajax("http://......com")",
cLabel:"push",
nPos:-1
})
Copy link to clipboard
Copied
Post your full code, please.
Copy link to clipboard
Copied
added now.
Copy link to clipboard
Copied
Could anyone provide even the slightest clue to solve this issue? @adobe community professionals, please help! I would really appreciate that.
Copy link to clipboard
Copied
It is best in these forums not to edit your original reply to add new information. People are unlikely to visit and read it again. Please always post new information in the form of a reply.
Copy link to clipboard
Copied
Okay, I will try to take care of it from next time. But for this specific issue, do you have any possible solutions?
Copy link to clipboard
Copied
I made a detailed reply and you did not even acknowledge it again. I will not try again.
"So you are trying to get to s page that needs login. And it hits the server but the server doesn’t pass it on. The whole idea of bypassing login with cookies is very suspect. Your front end probably does some security tests like cookie origin, cross domain checks or whatever. Maybe it sends challenge/response. We can’t know and external inspection can’t find out. If one could just copy cookies to bypass login the internet would be a very unsafe place. You need to liaise with your server developers to find a secure route for whatever thing you must do. "
Copy link to clipboard
Copied
Sorry for not acknowledging it. I might have missed it.
I am understanding what you are saying but the organization I am developing it for, do it using this only. I can't challenge this way of bypassing login using cookies. Given this, is there a way to solve this?