Hi all. I have a Python code here to do a POST API for getting cookies during login. It works well in the Python code, but when I try to implement this into OutSystems, I get a 422 error instead.
# Create a session to handle cookiessession = requests.Session()# Prepare the payloadpayload = { "username": username, "password": password}# Send the POST requestresponse = session.post(url, data=payload,verify=False)
Is there anything that I have missed to add? Thanks.
(Even if I add the username and password in the body content, it will still show 422 error.)
The problem is solved.
Have to set the Content-Type as "application/x-www-form-urlencoded", and Accept as "application/json". Then, in the body request, write 'grant_type=&username=nkymok&password=[***]&client_id=&client_secret='
Thanks all for your help
ref: https://github.com/fastapi/full-stack-fastapi-template/issues/431
Hi @Kwan Yat MOK ,
Usually you would get a 422 when there is any invalid data for which you are trying to process the request.
Try to set the Authentication to "No Authentication" and then pass the username and password only in the body (Please let me know if you are already doing this)
I believe, the JSON is a valid one, but the content is Unprocessable. Can you recheck what you are trying to achieve?
There is one similar case but in traditional check this also.
https://www.outsystems.com/forums/discussion/67314/error-code-422-unprocessable-entity/
Thanks