当我使用Express时,我的代码是:
app.use(express.bodyParser());
Run Code Online (Sandbox Code Playgroud)
我如何获得原始请求正文?
Shopify提供Ruby和PHP中的示例来实现此目的.在我的节点/快递应用程序中,我尝试:
var data = querystring.stringify(req.body);
var calculatedSha256 = crypto.createHmac("SHA256", APP_SECRET).update(new Buffer(data, 'utf8')).digest('base64');
Run Code Online (Sandbox Code Playgroud)
并且
var data = req.body;
var calculatedSha256 = crypto.createHmac("SHA256", APP_SECRET).update(new Buffer(data, 'utf8')).digest('base64');
Run Code Online (Sandbox Code Playgroud)
但是它们都没有提供与Shopify作为签名发送的字符串相同的字符串.