API needs SHA256 HMAC

I would advise to use strval($api_key) to make sure it’s always treated as a string.

1 Like

never used a custom formatter before, so sadly am going to need an explanation like you are explaining this to a toddler, how, where, what, why, who, when, etc. lol. pleeeesae

This is also interesting

Just to confirm, this is a server side formatter i need?

Where do you need it?

Yes, instructions here

1 Like

query parameter of a server side API action for auth=432hjkl423709hklmn32l489

Didn’t you just answer yourself? :joy:

Lol, no, confushious say whaat

Do my original notes help :roll_eyes:

2 Likes

Query parameter of a server side API Action for auth=$auth_token
$auth_token = hash_hmac(‘sha256’, $timestamp, $api_key);

What Brian said a few posts ago but I would say that:

hash_hmac( ‘sha256’ , strval($api_key))

1 Like

Lol,yeah, forgot to specify the encryption

1 Like

ok gonna try and will bug you if i get stuck

1 Like

LOL…you are actually not asking for the function…it’s already in the OP. I just noticed.

Yeah. Custom formatter all the way…I use quite a few. You won’t have any trouble with them.

I think the reason for the confusion is firstly i thought the custom formatters were only for App Connect, not Server Connect, and secondly it says save the file as custom.php or myFormatters.php and im in a node.js project wondering how this php thing is going to all fit together.
Anyway going to try and see what blows up

Wait. What? Are you on PHP or Node? You can’t use a php formatter with node.

1 Like

Just looked at node side of things. Looks like you need to create a new node module within a new index.js file

1 Like

Well I am trying out node for this particular project, so in node at the moment, but just looking at it even just using the run in browser in Node on a normal action is actually giving a file not found issue, so maybe i will revert to php for this initial test phase

managed to get onto computer
checking node formatters crypto.js seems to already have hmac

hmac: function(data, alg, secret, enc) {
return hmac(alg, data, secret, enc);
},

2 Likes