How debug sender script and show request in history

50 views
Skip to first unread message

testfordow...@gmail.com

unread,
Mar 14, 2024, 11:47:37 AM3/14/24
to ZAP User Group
Hello. 
I wrote Sender script for add Auth token but I can't debug it an what is incorrect. 
My script in attach.
In this script I watch access_token and if I don't have token or it's expired i send request to kafka and got new token. 

My problem it's:
when I send request for token I got 
`{u'error': u'invalid_request', u'error_description': u'Missing form parameter: grant_type'}`

But as I see in logs, parameter grant_type was send
It was in logs
```
array(java.lang.String, [u'client_id', u'grant_type', u'password', u'username'])
client_id=suz-web-app&username=user_oms&grant_type=password&password=Tds1111
{u'error': u'invalid_request', u'error_description': u'Missing form parameter: grant_type'}
('Access token is', None)
```

I can't understand where is a problem and how to find it?
If I'm sending the same request through postman and proxy all working correct. But at the first time I was getting the same error. In history METHOD changed to GET from POST. And in manual requester if I returned it to POST then I have got the same error 
`Missing form parameter: grant_type` when it was in the body
ds_session_header.py

Simon Bennetts

unread,
Mar 21, 2024, 9:14:43 AM3/21/24
to ZAP User Group
Sorry, that would take some time to debug and would probably require access to the running service.
Thats not something we have time to do for free I'm afraid.
We do now have commercial support options available: https://www.zaproxy.org/support/

Otherwise I'd recommend creating a test case with just one authenticated request - I usually use the Automation Framework for that.
You can also print to the ZAP script console to give you a better idea of exactly whats going on inside your scripts.

Cheers,

Simon
Reply all
Reply to author
Forward
0 new messages