Assertion is malformed and cannot be read! - in the REST (POST) call

I have been trying to implement microsoft office 365 API – Access Token generation, in which i am posting a request body in form of x-www-form-urlencoded where it doesn’t getting through the REST call due to the following error. {"error":"invalid_grant","error_description":"AADSTS500132: Assertion is malformed and cannot be read.\r\nTrace ID: 9aaad783-cf0c-48af-888c-b497e8681000\r\nCorrelation ID: 865f2703-c20b-4d00-b293-b05fab4c9e0f\r\nTimestamp: 2020-03-29 18:46:11Z","error_codes":[500132],"timestamp":"2020-03-29 18:46:11Z","trace_id":"9aaad783-cf0c-48af-888c-b497e8681000","correlation_id":"865f2703-c20b-4d00-b293-b05fab4c9e0f","error_uri":""} Here, you can find the actual implementation of the request and its body.     And i tested the same API in postman by copying the Assertion content i got in Mx end and pasted it in postman, it is working perfectly fine. looking for the great suggestion! thanks.  
1 answers

Hi Abdul, we can use “urlEncode” function to overcome the assertion problem

Create a variable  and pass the URL in the urlEncode function