Xero webhook extra slash but seems to match sig

Referencing: Catching Xero Webhook - #13 by Jeremy_Norberg

Works well, all responses come in just fine but for some weird reason the Xero sig has a “/” in it every time in varying places and doesn’t match the calculated sig, but is otherwise the same sig each time.

image

I’m not at all a programmer and the code from the guys above was just amazing to be able to get a more functioning Xero once the webhook starts returning data.

I can’t find any info online as to why there are extra slash but otherwise matching sig.

Is it going to be the code was written for an older n8n version last year and needs adapting somehow?

If anyone can point me in the right direction(as I don’t even know the cause and my GoogleFu isnt working) that would be appreciated.

Hi @rjodwyer, welcome to the community!

From looking at the code in the linked thread it seems to me this value isn’t modified by the code:

var xeroSig = items[0].json.headers['x-xero-signature']

This simply reads whatever x-xero-signature header is coming from the webhook and writes it into the xeroSig variable. Can you confirm what you’d like to see instead of the current value?

thanks @MutedJam , its very strange, but that slash comes from Xero every time, just in a different place each time, and if not for that slash the sig would match exactly what calculated from n8n as you can see from the screenshot.

as far as I understand it if the calc was out even 1 byte then the sig’s wouldnt be the same characters at all, but given they are nearly identical seems to indicate Xero is doing something weird.

I just wanted to make sure everything was ok, I’ll try and raise it with Xero but I don’t have high hopes of getting an answer before 2024.

thanks,

Unfortunately I am really not familiar with the data Xero sends here as this is not n8n functionality. But if the Slash is the the only problem you could consider simply removing it. Try replacing

var xeroSig = items[0].json.headers['x-xero-signature']

with

var xeroSig = items[0].json.headers['x-xero-signature'].replace('/', '');

This .replace() method should remove the slash.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.