Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

167
Vistas
SHA256 HMAC Request Doesn't Validate - Shopify OAuth

I'm having trouble validating the HMAC signature during Shopify OAuth.

When the merchant clicks "install", they are sent to my oauth URL. The url has params added to it like so:

https:my-appp.com/shopify_oauth?hmac=74dac492e0605a9d547e8e1e58a287a7748ce8e2679c40b8953d72691c3314c9&host=ZGdoYmpkZnNnYmpoLm15c2hvcGlmeS5jb20vYWRtaW4&shop=merchants_store.myshopify.com&timestamp=1654472682

As per the documentation

I strip out the HMAC, rebuild the query string with all other params in alphabetical order. Then I run it through a SHA-256 hash function including my apps secret api key.

var crypto = require('crypto')
                  , text = `host=${properties.keyvalues[0].value}&shop=${properties.thing1}&timestamp=${properties.thing2}`
                  , key = 'PRIVATE_API_KEY'
                  , hash;

var returnValue

var hash = crypto.createHmac('sha256', key).update(text).digest('hex');

//var base64 = Buffer.from(hash).toString('base64');

if (hash === shopifyHmac) {
returnValue = "true"

} else {
returnValue = "false"
}

The problem I'm running into is that the provided HMAC does not match the decoded querystring meaning it fails validation.

I've played around with the order of the URL params, as well as which params are included in the querystring. I've also tried encoding it as a base64 format.

Any idea where I'm going wrong?

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda