# Custom app - SHA256 PHP and JavaScript not equal

**URL:** <https://forum.shopware.com/t/custom-app-sha256-php-and-javascript-not-equal/89508>\
**Category:** Programmierung\
**Tags:** drittanbieter-plugin\
**Created:** [31. Juli 2021 um 12:29 UTC](https://forum.shopware.com/t/custom-app-sha256-php-and-javascript-not-equal/89508 "2021-07-31T12:29:58Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![keepoalaDev](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/keepoaladev/32/14404_2.png) [@keepoalaDev](https://forum.shopware.com/u/keepoalaDev)\
**Post date:** [31. Juli 2021 um 12:29 UTC](https://forum.shopware.com/t/custom-app-sha256-php-and-javascript-not-equal/89508/1 "2021-07-31T12:29:58Z")

</div>

Hi.

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](https://developer.shopware.com/docs/guides/plugins/apps/app-base-guide#confirmation-request)

Here is my Code and outcome:

```auto

 var obj = JSON.parse(data); //now it an object
 const encryption_token = all_tokens[shopid];
 console.log(JSON.stringify(req.body, null, 2))
// {
// "apiKey": "SWIAVZQZSXJSTVZKBKFQA1FQVQ",
// "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
                Latin1.parse(encryption_token)
            ).toString();
 console.log(our_encryption);
// d023f9b2d48e49fd8150920138afbaa1b00254a9e1b6fd329fda9975cb39b1ef
 console.log(signature);
//2ab5c057138f8dfc8f97aad1dc9b0d05599eac77aec8b0833472d1a136a0cdf8

```

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

Any possible solution?

---

<div class="post-metadata">

**Author:** ![keepoalaDev](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/keepoaladev/32/14404_2.png) [@keepoalaDev](https://forum.shopware.com/u/keepoalaDev)\
**Post date:** [31. Juli 2021 um 20:06 UTC](https://forum.shopware.com/t/custom-app-sha256-php-and-javascript-not-equal/89508/2 "2021-07-31T20:06:47Z")

</div>

Solved. PHP uses some weird `\` before any `/`.

This could be solved by using only the raw body.
