Custom app - SHA256 PHP and JavaScript not equal


I am trying to confirm the app registration within a JS App instead of a PHP App. Currently I am desperately searching for the right way to parse the body I receive from PHP.

Maybe you can give an example of a Body from App Base Guide - Shopware Developer

Here is my Code and outcome:

 var obj = JSON.parse(data); //now it an object
 const encryption_token = all_tokens[shopid];
 console.log(JSON.stringify(req.body, null, 2))
// {
//   "secretKey": "R2VVQTJSY21YUFVpaGRJcWZuY3A2T0kyWDhFa1VZZ2VTSHV6Rkc",
//   "timestamp": "1627734129",
//   "shopUrl": "http://localhost",
//   "shopId": "zISDYSSSAlNOp5cp"
// }
 const our_encryption = hmacSHA256(
                Latin1.parse(JSON.stringify(req.body, null, 2)), // use two letter spacing in JSON
// d023f9b2d48e49fd8150920138afbaa1b00254a9e1b6fd329fda9975cb39b1ef

I already tried with 4 and 0 spaces in JSON.stringify. Same result

Any possible solution?

Solved. PHP uses some weird \ before any /.

This could be solved by using only the raw body.