Hi everyone I'm new to zap and i'm testing it on an application which requires a jwt token as authentication
I already have the jwt token and i would like to feed it onto the headers to allow authentication.
For example i know a simple curl request does the trick adding headers like this
curl -H 'Accept: application/json' -H "Authorization: Bearer ${TOKEN}" localhost:8088/path/to/something/
I tried using a script to add new headers like in the curl message using the following jython script as a HTTPsender:
headers = dict({"Accept": "application/json",
"Authorization": "Bearer HARD_CODED_TOKEN"});
def sendingRequest(msg, initiator, helper):
for x in list(headers):
msg.getRequestHeader().setHeader(x, headers[x]);
def responseReceived(msg, initiator, helper):
pass;
Which is practically the same i found on the examples, still after i try to do the quick scan i am getting 401 response.
the curl instead retrieves a json response and is correctly authenticated.
Is there something I am missing? What am I doin wrong?
NB the HARD_CODED_TOKEN is a placeholder here in reality i just pasted the token