If the payload contains slashed and if you encode the data manually, then the default json_encode function escapes the slashes which causes the verification to fail.
In my case, I decoded the payload with json_decode and then encoded it before the verification. However, the payload contained the user agent data, which has slashes, and the json_encode function was escaping the slashes, causing the verification to fail. So, I encoded the data like json_encode($payload, JSON_UNESCAPED_SLASHES) with the flag, and it started to verify successfully.
If the payload contains slashed and if you encode the data manually, then the default
json_encode
function escapes the slashes which causes the verification to fail.In my case, I decoded the payload with
json_decode
and then encoded it before the verification. However, the payload contained the user agent data, which has slashes, and thejson_encode
function was escaping the slashes, causing the verification to fail. So, I encoded the data likejson_encode($payload, JSON_UNESCAPED_SLASHES)
with the flag, and it started to verify successfully.