Solved

Im having problem with the proxy signature verification

betoxx1
Excursionist
22 2 3

I fallow the steps on this link:

https://shopify.dev/tutorials/display-data-on-an-online-store-with-an-application-proxy-app-extensio...

And i endUp with this test code on node js with express to validate the signature:  

 

const SHARED_SECRET = '<My App scret key>'
const query_signature = req.query.signature

const sorted_params = "extra=1,2path_prefix="+req.query.path_prefix+"shop="+req.query.shop+"timestamp="+req.query.timestamp
let calculated_signature = crypto.createHmac('sha256', SHARED_SECRET).update(sorted_params).digest('hex')

if(query_signature == calculated_signature) return True

 

when i check the data on console, they are diferent:

 

    console.log("query:",req.query.signature)
    console.log("hash: ",calculated_signature)

 

Example of log: 
query: 0e22cdb17c43a38d6f7254c77eef1e7e9ef50294fc1f096eab096d09f476581a
hash: f1611e5f5b19fade24a12ec7443105a1cda29cc39977c20cf69e4bd1db1dabc3

Can some one tell me what Am I doing wrong?

I would appreciate any help 😞

 

Accepted Solution (1)

betoxx1
Excursionist
22 2 3

This is an accepted solution.

guys I was actually able to solve the issue. 

The problem wass that i was using this to make the signature: 

 

 

const sorted_params = "extra=1,2path_prefix="+req.query.path_prefix+"shop="+req.query.shop+"timestamp="+req.query.timestamp

 

 

But I wass receiving this:

Query: {
shop: 'multimaxtest2.myshopify.com',
path_prefix: '/apps/test',
timestamp: '1609029203',
signature: '************************'
}

As you can see the extra=1,2 paragram is not send by the request, So I only changed sorted_params value to this:

 

 

const sorted_params = "path_prefix="+req.query.path_prefix+"shop="+req.query.shop+"timestamp="+req.query.timestamp

 

 

 

And it start working.

View solution in original post

Reply 1 (1)

betoxx1
Excursionist
22 2 3

This is an accepted solution.

guys I was actually able to solve the issue. 

The problem wass that i was using this to make the signature: 

 

 

const sorted_params = "extra=1,2path_prefix="+req.query.path_prefix+"shop="+req.query.shop+"timestamp="+req.query.timestamp

 

 

But I wass receiving this:

Query: {
shop: 'multimaxtest2.myshopify.com',
path_prefix: '/apps/test',
timestamp: '1609029203',
signature: '************************'
}

As you can see the extra=1,2 paragram is not send by the request, So I only changed sorted_params value to this:

 

 

const sorted_params = "path_prefix="+req.query.path_prefix+"shop="+req.query.shop+"timestamp="+req.query.timestamp

 

 

 

And it start working.