Base64-encoded HMAC-SHA256 signature?

hey everybody,

I annoyed the forum now a couple of times regarding the Amazon Product Advertising API (sorry guys…). The incredible guys from https://airdev.co/ @gaurav now helped me and have setup the API Call for me.

The only problem is that the API Call requires a signature and a timestamp. The signature is a “base64-encoded HMAC-SHA256 signature” (see here for more information: http://docs.aws.amazon.com/AWSECommerceService/latest/DG/HMACSignatures.html)

Since I am really clueless and far away from a coder I am posting @gaurav’s answer to me:

"It looks like there are 2 more parameters required: Signature and Timestamp. The endpoint doesnt seem to accept unsigned requests (i.e. without signature)

_Couldnt get it to work due to requirement of a ‘base64-encoded HMAC-SHA256 signature’ to be generated by using the access key."

@emmanuel

Is this something where you can help us out here? This is really the last big issue which is keeping me away from publishing my app. I am sorry for annoying you guys I know you have enough things on your list but if you could help out here I would really appreciate it.

Thank you!!!

This is not something we support out of the box, so please reach out by email as it’s a (not quick) feature request.

1 Like

thaks emmanuel. Will write an email now.

@emmanuel (sorry for tagging you again :sweat:)

would it be possible to integrate this:

crypto-js - JavaScript library of crypto standards.

This could maybe help other users too (Generate SHA256 hash for API-token)

Thank you!

1 Like

@pat did you have any luck with this? I’m trying to connect to the Product Advertising API also.

@Kfawcett there’s a blockspring block called ‘encryption’. That might be helpful to you.

The incredible guys from airdev helped me with this and it works just perfect.

If you need screenshots of the workflow or any help let me know!

2 Likes

@Pat screenshots would be awesome. I’ve got the call setup, but now I’m working on getting the Timestamp formatted and then will have to figure out the signature. That seems like the most complex part.

@gaurav thanks, but blockspring would be another monthly cost for something that we should be able to do in Bubble.

1 Like

Hey Keith,

Sorry maybe I was not clear enough about this. Airdev and @gaurav helped me to implement it with Blockspring. I would also like to have it implemented directly in bubble but Emmanuel said it is not an easy fix.

If you still need help with Blockspring and the encryption let me know.

It would be interesting to see how you guys used went about integrating block spring. Any chance of a brief write-up for the community?

I can try to write something tomorrow.

But again I have to say all the credit goes to Airdev. I can only recommend to contact them to outsource some of the more difficult parts of app development.

3 Likes

Trying to do a similar thing with HMAC-SHA256 - is Blockspring still the best solution?

yep afaik

Hello Pat, I would greatly appreciate your help with this. I need to create a HMAC-SHA256 signature with a couple more parameters, I am pretty lost on how to do this, it seems I have to do it through a Workflow+Blockspring and then send it to the api? How do I do this?.

Thank you for your time!

You can use the plugin ToolBox. It’s got a workflow action called ‘Server script’, with which you can use Node.js’s built-in modules ‘crypto’ and ‘buffers’:

var crypto = require('crypto')
                  , text = 'I love cupcakes'
                  , key = 'abcdeghi'
                  , hash;

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

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

base64;
5 Likes

Hi @miguel

I tried the your mentioned script above in Toolbox’s server script (first time trying server script), but getting a bubble server error. Below is the screen shot of what I’ve entered. I have the data being displayed as a result in a group. What am I missing or doing wrong for this static example?

thx

1 Like

I think you need to type base 64; in a separate line at the end, because that’s what the script will return.

I will update the script I posted.

Let me know if it helped.

1 Like

Hey @miguel can you help me with the code to just convert an image to base64? We’re trying to integrate Onfido Api and they require the images to be sent in base64 format in the API. I’ve been struggling finding the solution an finally came across this thread.

Need your help bro. Want set up the MWS API.

Yeah, that worked, thank you!

1 Like